﻿namespace QLPhongKham.UC
{
    using DevExpress.Data;
    using DevExpress.Utils;
    using DevExpress.XtraBars;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Mask;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using DevExpress.XtraTab;
    using DevExpress.XtraTreeList;
    using DevExpress.XtraTreeList.Columns;
    using DevExpress.XtraTreeList.Nodes;
    using QLPhongKham.Access;
    using QLPhongKham.Access.BenhNhan;
    using QLPhongKham.Access.Duoc;
    using QLPhongKham.BaseClass.BenhNhan;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using UserControls;

    public class ucbn_khambenh : XtraUserControl
    {
        private DataTable _dtkhambenh;
        private dtoBNThongTinBN _dtobn;
        private dtoBNTiepDon _dtotd;
        private DataTable _dttiepdon;
        private int _iiddangnhap;
        private BNKhamBenh _khambenh;
        private BNTiepDon _tiepdon;
        private BNThongSo _tsbenhnhan;
        private ucbn_thongtinbn _ucbn;
        private General _xuli;
        private Bar bar1;
        private BarDockControl barDockControlBottom;
        private BarDockControl barDockControlLeft;
        private BarDockControl barDockControlRight;
        private BarDockControl barDockControlTop;
        private BarManager barManager1;
        private BarStaticItem barStaticItem1;
        private BarButtonItem bbicaptoa;
        private BarButtonItem bbichidinh;
        private BarButtonItem bbidsbncho;
        private BarButtonItem bbitoamuangoai;
        private SimpleButton btnthembenhtat;
        private SimpleButton btntimbn;
        private CheckedListBox clbxutri;
        private IContainer components;
        private ctrdanhsach ctrdanhsach_bsdt;
        private ctrdanhsach ctrdanhsach_cd;
        private ctrdanhsach ctrdanhsach_cdkt;
        private DateEdit datengaygio;
        private GridControl gridds;
        private GridColumn gridds_id;
        private GridColumn gridds_ma;
        private GridColumn gridds_namsinh;
        private GridColumn gridds_ten;
        private GridView gridView1;
        private GroupControl groupControl1;
        private GroupControl groupControl2;
        private GroupControl groupControl3;
        private GroupControl groupControl4;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label13;
        private Label label14;
        private Label label15;
        private Label label16;
        private Label label17;
        private Label label18;
        private Label label19;
        private Label label2;
        private Label label20;
        private Label label21;
        private Label label22;
        private Label label23;
        private Label label24;
        private Label label25;
        private Label label26;
        private Label label27;
        private Label label28;
        private Label label29;
        private Label label3;
        private Label label30;
        private Label label31;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        private LookUpEdit lkephong;
        private LookUpEdit lkpdoituong;
        private LookUpEdit lkploaituoi;
        private RadioButton rdbnam;
        private RadioButton rdbnu;
        private RepositoryItemTextEdit repositoryItemTextEdit1;
        private RepositoryItemTextEdit repositoryItemTextEdit2;
        private RepositoryItemTextEdit repositoryItemTextEdit3;
        private SimpleButton sbtnboqua;
        private SimpleButton sbtnketthuc;
        private SimpleButton sbtnluu;
        private SimpleButton sbtnsua;
        private SimpleButton sbtntieptheo;
        private TreeList tldk;
        private TreeListColumn tldk_id;
        private TreeListColumn tldk_idql;
        private TreeListColumn tldk_ten;
        private TextEdit txtcannang;
        private TextEdit txtdiachi;
        private TextEdit txtdienthoai;
        private TextEdit txtghichu;
        private TextEdit txthoten;
        private TextEdit txthuyetap;
        private TextEdit txtlydokham;
        private TextEdit txtmabacsi;
        private TextEdit txtmabn2;
        private TextEdit txtmach;
        private TextEdit txtmachandoan;
        private TextEdit txtmachandoankt;
        private TextEdit txtmaphuongxa;
        private TextEdit txtnamsinh;
        private MaskedTextBox txtngaysinh;
        private TextEdit txtnguoithan;
        private TextEdit txtnguoithanlienhe;
        private TextEdit txtnguoithanten;
        private TextEdit txtnhietdo;
        private TextEdit txtstt;
        private TextEdit txttenbacsi;
        private TextEdit txttenchandoan;
        private TextEdit txttenchandoankt;
        private TextEdit txttenphuongxa;
        private TextEdit txttrieuchung;
        private TextEdit txttuoi;
        private TextEdit txtxutri;
        private ucbn_dsbncho ucdsbncho;

        public ucbn_khambenh()
        {
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
        }

        public ucbn_khambenh(int iddangnhap)
        {
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
            this._iiddangnhap = iddangnhap;
        }

        public ucbn_khambenh(General xuli, int iddangnhap)
        {
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = xuli;
            this._iiddangnhap = iddangnhap;
        }

        private void bbicaptoa_ItemClick(object sender, ItemClickEventArgs e)
        {
            long idql = long.Parse(this.datengaygio.Tag.ToString());
            if ((this.bbicaptoa.Visibility != BarItemVisibility.Never) && (idql != 0L))
            {
                ucbn_captoathuoc _captoathuoc = new ucbn_captoathuoc(this._xuli, idql, HangSo.LoaiBenhNhan.pPhongKham, this._iiddangnhap);
                _captoathuoc.Show();
                base.Controls.Add(_captoathuoc);
                _captoathuoc.Location = new Point(0, 0);
                _captoathuoc.Width = base.Width;
                _captoathuoc.Height = base.Height;
                _captoathuoc.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
                _captoathuoc.BringToFront();
            }
        }

        private void bbichidinh_ItemClick(object sender, ItemClickEventArgs e)
        {
            long idql = long.Parse(this.datengaygio.Tag.ToString());
            if ((this.bbichidinh.Visibility != BarItemVisibility.Never) && (idql != 0L))
            {
                ucbn_chidinh _chidinh = new ucbn_chidinh(this._xuli, idql, HangSo.LoaiBenhNhan.pPhongKham);
                _chidinh.Show();
                base.Controls.Add(_chidinh);
                _chidinh.Location = new Point(0, 0);
                _chidinh.Width = base.Width;
                _chidinh.Height = base.Height;
                _chidinh.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
                _chidinh.BringToFront();
            }
        }

        private void bbidsbncho_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.bbichidinh.Visibility != BarItemVisibility.Never)
            {
                this.ucdsbncho = new ucbn_dsbncho();
                this.ucdsbncho.Show();
                base.Controls.Add(this.ucdsbncho);
                this.ucdsbncho.Location = new Point(0, 0);
                this.ucdsbncho.Width = base.Width;
                this.ucdsbncho.Height = base.Height;
                this.ucdsbncho.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
                this.ucdsbncho.BringToFront();
                this.ucdsbncho.Focus();
            }
        }

        private void bbitoamuangoai_ItemClick(object sender, ItemClickEventArgs e)
        {
            long idql = long.Parse(this.datengaygio.Tag.ToString());
            if ((this.bbicaptoa.Visibility != BarItemVisibility.Never) && (idql != 0L))
            {
                ucbn_captoathuocmuangoai _captoathuocmuangoai = new ucbn_captoathuocmuangoai(this._xuli, idql, HangSo.LoaiBenhNhan.pPhongKham, this._iiddangnhap);
                _captoathuocmuangoai.Show();
                base.Controls.Add(_captoathuocmuangoai);
                _captoathuocmuangoai.Location = new Point(0, 0);
                _captoathuocmuangoai.Width = base.Width;
                _captoathuocmuangoai.Height = base.Height;
                _captoathuocmuangoai.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
                _captoathuocmuangoai.BringToFront();
            }
        }

        private void btnthembenhtat_Click(object sender, EventArgs e)
        {
            ucbn_dmbenhtat _dmbenhtat = new ucbn_dmbenhtat();
            base.Controls.Add(_dmbenhtat);
            _dmbenhtat.Location = new Point(0, 0);
            _dmbenhtat.Width = base.Width;
            _dmbenhtat.Height = base.Height;
            _dmbenhtat.Show();
            _dmbenhtat.BringToFront();
        }

        private void btntimbn_Click(object sender, EventArgs e)
        {
            this._ucbn = new ucbn_thongtinbn(this._xuli);
            this._ucbn.pLayThongTinBN = true;
            base.Controls.Add(this._ucbn);
            this._ucbn.Height = base.Height;
            this._ucbn.Width = base.Width;
            this._ucbn.Location = new Point(0, 0);
            this._ucbn.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this._ucbn.BringToFront();
        }

        private void clbxutri_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
        {
            string text = this.txtxutri.Text;
            if (e.NewValue == CheckState.Checked)
            {
                text = text.Replace("0" + (e.Index + 1) + ",", "") + ("0" + (e.Index + 1) + ",");
            }
            else
            {
                text = text.Replace("0" + (e.Index + 1) + ",", "");
            }
            this.txtxutri.Text = text;
        }

        private void ctrdanhsach_bsdt_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_bsdt.DongHienTai;
                this.f_load_control_dmbs(int.Parse(dongHienTai.Rows[0]["id"].ToString()), dongHienTai.Rows[0]["ma"].ToString(), dongHienTai.Rows[0]["ten"].ToString());
            }
            catch
            {
                this.f_load_control_dmbs(0, "", "");
            }
        }

        private void ctrdanhsach_cd_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_cd.DongHienTai;
                this.f_load_control_dmbenhtat(long.Parse(dongHienTai.Rows[0]["id"].ToString()), dongHienTai.Rows[0]["ma"].ToString(), dongHienTai.Rows[0]["ten"].ToString());
            }
            catch
            {
                this.f_load_control_dmbenhtat(0L, "", "");
            }
        }

        private void ctrdanhsach_cdkt_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_cdkt.DongHienTai;
                this.f_load_control_dmbenhkemtheo(long.Parse(dongHienTai.Rows[0]["id"].ToString()), dongHienTai.Rows[0]["ma"].ToString(), dongHienTai.Rows[0]["ten"].ToString());
            }
            catch
            {
                this.f_load_control_dmbenhkemtheo(0L, "", "");
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private bool f_kiemtra_luu()
        {
            string text = this.txtmabn2.Text;
            if (this.datengaygio.Tag == null)
            {
                this.datengaygio.Tag = 0;
            }
            if ((this.datengaygio.Tag.ToString() != "0") && (text.Length < 10))
            {
                MessageBox.Show("Chưa nhập m\x00e3 bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtmabn2.Focus();
                return false;
            }
            if (this.txthoten.Text == "")
            {
                MessageBox.Show("Chưa nhập họ v\x00e0 t\x00ean của bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txthoten.Focus();
                return false;
            }
            try
            {
                int num = Convert.ToInt16(this.txtnamsinh.Text);
            }
            catch
            {
                MessageBox.Show("Chưa nhập năm sinh của bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtnamsinh.Focus();
                return false;
            }
            try
            {
                int num2 = Convert.ToInt16(this.txttuoi.Text);
            }
            catch
            {
                MessageBox.Show("Chưa nhập tuổi hoặc số tuổi của bệnh nh\x00e2n kh\x00f4ng đ\x00fang.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txttuoi.Focus();
                return false;
            }
            try
            {
                DateTime time = new DateTime(Convert.ToInt16(this.datengaygio.Text.Substring(6, 4)), Convert.ToInt16(this.datengaygio.Text.Substring(3, 2)), Convert.ToInt16(this.datengaygio.Text.Substring(0, 2)), Convert.ToInt16(this.datengaygio.Text.Substring(11, 2)), Convert.ToInt16(this.datengaygio.Text.Substring(14, 2)), 0);
                if (DateTime.Now < ((DateTime) this.datengaygio.EditValue))
                {
                    MessageBox.Show("Ng\x00e0y giờ đăng k\x00fd kh\x00e1m kh\x00f4ng được lớn hơn ng\x00e0y hiện tại.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    this.datengaygio.Focus();
                    return false;
                }
            }
            catch
            {
                MessageBox.Show("Ng\x00e0y giờ kh\x00f4ng đ\x00fang.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.datengaygio.Focus();
                return false;
            }
            if (this.lkpdoituong.EditValue == null)
            {
                MessageBox.Show("Chưa nhập đối tượng của bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.lkpdoituong.Focus();
                return false;
            }
            if (this.lkephong.EditValue == null)
            {
                MessageBox.Show("Chưa nhập khoa ph\x00f2ng cho bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.lkephong.Focus();
                return false;
            }
            try
            {
                int num3 = Convert.ToInt16(this.txtstt.Text);
            }
            catch
            {
                MessageBox.Show("Số thứ tự của bệnh nh\x00e2n kh\x00f4ng đ\x00fang.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtstt.Focus();
                return false;
            }
            if (this.txttenchandoan.Text == "")
            {
                MessageBox.Show("Chưa nhập chẩn đo\x00e1n bệnh ch\x00ednh.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txttenchandoan.Focus();
                return false;
            }
            if (this.txttenbacsi.Text == "")
            {
                MessageBox.Show("Chưa nhập t\x00ean b\x00e1c sĩ điều trị.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txttenbacsi.Focus();
                return false;
            }
            if (this.txtxutri.Text == "")
            {
                MessageBox.Show("Chưa nhập xử tr\x00ed cho bệnh nh\x00e2n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtxutri.Focus();
                return false;
            }
            return true;
        }

        private void f_load_bacsi(int idbacsi)
        {
            try
            {
                DataRow row = this.ctrdanhsach_bsdt.SetDataSource.Select("id=" + idbacsi)[0];
                this.f_load_control_dmbs(int.Parse(row["id"].ToString()), row["ma"].ToString(), row["ten"].ToString());
            }
            catch
            {
            }
        }

        private bool f_load_bacsi(string ma)
        {
            try
            {
                DataRow row = this.ctrdanhsach_bsdt.SetDataSource.Select("ma='" + ma + "'")[0];
                this.f_load_control_dmbs(int.Parse(row["id"].ToString()), row["ma"].ToString(), row["ten"].ToString());
                return true;
            }
            catch
            {
                return false;
            }
        }

        private void f_load_benhkemtheo(long idbenhtat)
        {
            DataTable setDataSource = this.ctrdanhsach_cdkt.SetDataSource;
            try
            {
                DataRow row = setDataSource.Select("id=" + idbenhtat)[0];
                this.f_load_control_dmbenhkemtheo(long.Parse(row["id"].ToString()), row["ma"].ToString(), row["ten"].ToString());
            }
            catch
            {
                this.f_load_control_dmbenhkemtheo(0L, "", "");
            }
        }

        private void f_load_benhkemtheo(string ma)
        {
            DataRow row = this.ctrdanhsach_cdkt.SetDataSource.Select("ma='" + ma + "'")[0];
            this.f_load_control_dmbenhkemtheo(long.Parse(row["id"].ToString()), row["ma"].ToString(), row["ten"].ToString());
        }

        private void f_load_benhtat(long idbenhtat)
        {
            DataTable setDataSource = this.ctrdanhsach_cd.SetDataSource;
            try
            {
                DataRow row = setDataSource.Select("id=" + idbenhtat)[0];
                this.f_load_control_dmbenhtat(long.Parse(row["id"].ToString()), row["ma"].ToString(), row["ten"].ToString());
            }
            catch
            {
                this.f_load_control_dmbenhtat(0L, "", "");
            }
        }

        private void f_load_benhtat(string ma)
        {
            DataRow row = this.ctrdanhsach_cd.SetDataSource.Select("ma='" + ma + "'")[0];
            this.f_load_control_dmbenhtat(long.Parse(row["id"].ToString()), row["ma"].ToString(), row["ten"].ToString());
        }

        private void f_load_control_dmbenhkemtheo(long id, string ma, string ten)
        {
            this.txtmachandoankt.Tag = id.ToString();
            this.txtmachandoankt.Text = ma;
            this.txttenchandoankt.Text = ten;
        }

        private void f_load_control_dmbenhtat(long id, string ma, string ten)
        {
            this.txtmachandoan.Tag = id.ToString();
            this.txtmachandoan.Text = ma;
            this.txttenchandoan.Text = ten;
        }

        private void f_load_control_dmbs(int id, string ma, string ten)
        {
            this.txtmabacsi.Tag = id.ToString();
            this.txtmabacsi.Text = ma;
            this.txttenbacsi.Text = ten;
        }

        private void f_load_dsbnchokham()
        {
            int num = 0;
            try
            {
                num = this._tsbenhnhan.pKB_A4_SoNgayBNChoKB(this._iiddangnhap);
            }
            catch
            {
            }
            if (num == 0)
            {
                num = -1;
            }
            DataTable table = new BNTiepDon().f_loaddata_dsbnchokham(DateTime.Now.AddDays((double) -num).ToString("dd/MM/yyyy"), DateTime.Now.ToString("dd/MM/yyyy"), "");
            this.gridds.DataSource = table;
        }

        private void f_load_xutri(string xutri)
        {
            try
            {
                for (int i = 0; i < this.clbxutri.Items.Count; i++)
                {
                    this.clbxutri.SetItemChecked(i, xutri.IndexOf(this.clbxutri.Items[i].ToString().Substring(0, 2)) > -1);
                }
            }
            catch
            {
            }
        }

        private void f_loadcontrol_benhnhan(string mabn, string hoten, int gioitinh, string ngaysinh, int namsinh, string diachi, string dienthoai, long idphuongxa)
        {
            try
            {
                this.txtmabn2.Text = mabn;
            }
            catch
            {
            }
            this.txthoten.Text = hoten;
            if (gioitinh == 0)
            {
                this.rdbnam.Checked = true;
            }
            else
            {
                this.rdbnu.Checked = true;
            }
            this.txtngaysinh.Text = ngaysinh;
            this.txtnamsinh.Text = (namsinh == 0) ? "" : namsinh.ToString();
            this.txtnamsinh_Validated(null, null);
            this.txtdiachi.Text = diachi;
            this.txtdienthoai.Text = dienthoai;
            this.f_setcontrol_phuongxa(idphuongxa, "");
        }

        private void f_loadcontrol_caclankb(string mabn)
        {
            this.tldk.ClearNodes();
            DataTable table = new DataTable();
            table = this._khambenh.f_loaddata_bnkhambenh(mabn);
            this._dtkhambenh = table.Copy();
            DataTable table2 = new BNChiDinh(this._xuli.pConFigData).f_loaddata_chidinh(mabn, true);
            DataTable table3 = new DToaThuoc(this._xuli.pConFigData).f_loaddata_toathuocct(0L, 0L, mabn);
            DataTable table4 = new DToaThuoc(this._xuli.pConFigData).f_loaddata_toathuoc_ngoaivienct(0L, 0L, mabn);
            for (int i = 0; i < table.Rows.Count; i++)
            {
                TreeListNode node3;
                TreeListNode node4;
                TreeListNode parentNode = this.tldk.AppendNode(new object[] { table.Rows[i]["ngay"].ToString() + " [" + table.Rows[i]["tendoituong"].ToString() + "]", table.Rows[i]["idql"].ToString(), 0 }, (TreeListNode) null);
                TreeListNode node2 = this.tldk.AppendNode(new object[] { table.Rows[i]["tenphong"].ToString(), table.Rows[i]["idql"].ToString(), 0 }, parentNode);
                node2 = this.tldk.AppendNode(new object[] { table.Rows[i]["chandoan"].ToString(), table.Rows[i]["idql"].ToString(), 0 }, parentNode);
                DataRow[] rowArray = table2.Select("idql=" + table.Rows[i]["idql"].ToString());
                if (rowArray.Length > 0)
                {
                    node3 = this.tldk.AppendNode(new object[] { "Chỉ định dịch vụ:", table.Rows[i]["idql"].ToString(), 0 }, parentNode);
                    foreach (DataRow row in rowArray)
                    {
                        node4 = this.tldk.AppendNode(new object[] { row["tenvp"].ToString(), table.Rows[i]["idql"].ToString(), 0 }, node3);
                    }
                }
                if ((table4.Select("idql=" + table.Rows[i]["idql"].ToString()).Length > 0) || (table3.Select("idql=" + table.Rows[i]["idql"].ToString()).Length > 0))
                {
                    node3 = this.tldk.AppendNode(new object[] { "Toa thuốc:", table.Rows[i]["idql"].ToString(), 0 }, parentNode);
                    foreach (DataRow row in table3.Select("idql=" + table.Rows[i]["idql"].ToString()))
                    {
                        node4 = this.tldk.AppendNode(new object[] { row["tenvp"].ToString(), table.Rows[i]["idql"].ToString(), 0 }, node3);
                    }
                    foreach (DataRow row in table4.Select("idql=" + table.Rows[i]["idql"].ToString()))
                    {
                        node4 = this.tldk.AppendNode(new object[] { row["tenvp"].ToString(), table.Rows[i]["idql"].ToString(), 0 }, node3);
                    }
                }
            }
        }

        private void f_loadcontrol_chophepsua(bool chophep)
        {
            if (this._tsbenhnhan.pKB_A2_CapToaNoiVien(this._iiddangnhap))
            {
                this.bbicaptoa.Visibility = BarItemVisibility.Always;
            }
            else
            {
                this.bbicaptoa.Visibility = BarItemVisibility.Never;
            }
            if (this._tsbenhnhan.pKB_A1_CapToaNgoaiVien(this._iiddangnhap))
            {
                this.bbitoamuangoai.Visibility = BarItemVisibility.Always;
            }
            else
            {
                this.bbitoamuangoai.Visibility = BarItemVisibility.Never;
            }
            this.bbichidinh.Visibility = BarItemVisibility.Always;
            this.sbtntieptheo.Enabled = this.sbtnketthuc.Enabled = this.sbtnsua.Enabled = this.groupControl3.Enabled = !chophep;
            this.sbtnluu.Enabled = this.sbtnboqua.Enabled = this.bbidsbncho.Enabled = chophep;
        }

        private void f_loadcontrol_thongtinkb(long idql, string ngaygio, int iddoituong, decimal idphong, string trieuchung, string tenchandoan, int idchandoan, string tenchandoankt, int idchandoankt, int idbacsi, string xutri, string ghichu)
        {
            this.datengaygio.Tag = idql;
            try
            {
                this.datengaygio.EditValue = new DateTime(int.Parse(ngaygio.Substring(6, 4)), int.Parse(ngaygio.Substring(3, 2)), int.Parse(ngaygio.Substring(0, 2)), int.Parse(ngaygio.Substring(11, 2)), int.Parse(ngaygio.Substring(14, 2)), 0);
            }
            catch
            {
            }
            this.lkpdoituong.EditValue = iddoituong;
            this.lkephong.EditValue = idphong;
            this.txttrieuchung.Text = trieuchung;
            this.txttenchandoan.Text = tenchandoan;
            this.txttenchandoankt.Text = tenchandoankt;
            this.txtxutri.Text = xutri;
            this.f_load_xutri(this.txtxutri.Text);
            this.txtghichu.Text = ghichu;
            this.f_load_bacsi(idbacsi);
            this.f_load_benhtat((long) idchandoan);
            this.f_load_benhkemtheo((long) idchandoankt);
        }

        private void f_loadcontrol_thongtinlienhe(string quanhe, string hoten, string diachi, string dienthoai)
        {
            this.txtnguoithan.Text = quanhe;
            this.txtnguoithanten.Text = hoten;
            this.txtnguoithanlienhe.Text = diachi;
        }

        private void f_loadcontrol_thongtintd(long idql, string ngaygio, int iddoituong, decimal idphong, string mach, string nhietdo, string huyetap, string cannang, int stt, string lydokham)
        {
            this.txthoten.Tag = idql;
            try
            {
                this.datengaygio.EditValue = new DateTime(int.Parse(ngaygio.Substring(6, 4)), int.Parse(ngaygio.Substring(3, 2)), int.Parse(ngaygio.Substring(0, 2)), int.Parse(ngaygio.Substring(11, 2)), int.Parse(ngaygio.Substring(14, 2)), 0);
            }
            catch
            {
            }
            this.lkpdoituong.EditValue = iddoituong;
            this.lkephong.EditValue = idphong;
            if (this.lkephong.Text == "")
            {
                this.lkephong.ItemIndex = 0;
            }
            this.txtmach.Text = mach;
            this.txtnhietdo.Text = nhietdo;
            this.txthuyetap.Text = huyetap;
            this.txtcannang.Text = cannang;
            this.txtstt.Text = stt.ToString();
            this.txtlydokham.Text = lydokham;
        }

        private void f_loaddata_dmbacsi()
        {
            try
            {
                DataTable table = new BNDanhMuc(this._xuli.pConFigData).f_load_bn_dmbacsi();
                this.ctrdanhsach_bsdt.SetDataSource = table;
                this.ctrdanhsach_bsdt.DanhSachCotHienThi = "ma,ten";
                if (this.ctrdanhsach_bsdt.SetDataSource.Rows.Count == 1)
                {
                    try
                    {
                        this.f_load_control_dmbs(int.Parse(table.Rows[0]["id"].ToString()), table.Rows[0]["ma"].ToString(), table.Rows[0]["ten"].ToString());
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
        }

        private void f_loaddata_dmbenhtat()
        {
            try
            {
                DataTable table = new BNDanhMuc(this._xuli.pConFigData).f_load_bn_dmbenhtat();
                this.ctrdanhsach_cd.SetDataSource = table;
                this.ctrdanhsach_cd.DanhSachCotHienThi = "ma,ten";
                this.ctrdanhsach_cdkt.SetDataSource = table.Copy();
                this.ctrdanhsach_cdkt.DanhSachCotHienThi = "ma,ten";
            }
            catch
            {
            }
        }

        private void f_setcontrol_bnkhambenh(long idql, string mabn)
        {
            dtoBNTiepDon don = new dtoBNTiepDon(this._xuli.pConFigData) {
                pIDQL = idql
            };
            don.Load();
            this.f_loadcontrol_thongtintd(don.pIDQL, don.pNGAY, don.pIDDOITUONG, Convert.ToDecimal(don.pIDPHONG), don.pMACH, don.pNHIETDO, don.pHUYETAP, don.pCANNANG, don.pSTT, don.pLYDOKHAM);
            dtoBNThongTinBN nbn = new dtoBNThongTinBN(this._xuli.pConFigData) {
                MABN = (mabn != "") ? mabn : don.pMABN
            };
            nbn.Load();
            this.f_loadcontrol_benhnhan(nbn.MABN, nbn.HOTEN, nbn.IDGIOITINH, nbn.NGAYSINH, nbn.NAMSINH, nbn.DIACHI, nbn.DIENTHOAI, nbn.IDPHUONGXA);
            dtoBNThongTinBN_LienHe he = new dtoBNThongTinBN_LienHe(this._xuli.pConFigData) {
                IDQL = don.pIDQL
            };
            he.Load();
            this.f_loadcontrol_thongtinlienhe(he.QUANHE, he.HOTEN, he.DIACHI, he.DIENTHOAI);
            dtoBNBenhAnKB nkb = new dtoBNBenhAnKB(this._xuli.pConFigData) {
                pIDQL = idql
            };
            nkb.Load();
            this.f_loadcontrol_thongtinkb(nkb.pIDQL, nkb.pNGAY, nkb.pIDDOITUONG, Convert.ToDecimal(nkb.pIDPHONG), nkb.pTRIEUCHUNG, nkb.pBENHCHINH, nkb.pIDBENHCHINH, nkb.pBENHKEMTHEO, nkb.pIDBENHKEMTHEO, nkb.pIDBACSI, nkb.pXUTRI, nkb.pGHICHU);
            this.datengaygio.Tag = don.pIDQL;
        }

        private void f_setcontrol_phuongxa(long id, string viettat)
        {
            try
            {
                DataTable table = new BNDanhMuc(this._xuli.pConFigData).f_loaddata_tinhphuongxa(viettat, id);
                this.txttenphuongxa.Text = table.Rows[0]["ten"].ToString();
                this.txttenphuongxa.Tag = table.Rows[0]["idtinhthanh"].ToString() + "^" + table.Rows[0]["idquanhuyen"].ToString() + "^" + table.Rows[0]["idphuongxa"].ToString();
                this.txtmaphuongxa.Tag = table.Rows[0]["id"].ToString();
                this.txtmaphuongxa.Text = table.Rows[0]["viettat"].ToString();
            }
            catch
            {
                this.txttenphuongxa.Text = "";
                this.txtmaphuongxa.Tag = 0;
                this.txtmaphuongxa.Text = "";
            }
        }

        private void f_tinh_tuoi()
        {
            try
            {
                DateTime now = DateTime.Now;
                if (this.txtngaysinh.Text != "")
                {
                    try
                    {
                        now = new BNTiepDon().f_tinh_ngaytuoi(this.txtngaysinh.Text, 0, 0, 0);
                    }
                    catch
                    {
                    }
                }
                if (this.txtnamsinh.Text == "")
                {
                    this.txtnamsinh.Text = now.Year.ToString();
                }
                if (this.txttuoi.Text == "")
                {
                    int num = DateTime.Now.Year - int.Parse(this.txtnamsinh.Text);
                    if (num > 0)
                    {
                        this.txttuoi.Text =string.Concat(num + 1);
                        this.lkploaituoi.EditValue = HangSo.LoaiTuoi.pTuoi;
                    }
                    else if (this.txtngaysinh.Text != "")
                    {
                        while (string.Compare(now.ToString("yyyyMM"), DateTime.Now.ToString("yyyyMM")) < 1)
                        {
                            num++;
                        }
                        this.txttuoi.Text = num.ToString();
                        this.lkploaituoi.EditValue = HangSo.LoaiTuoi.pThang;
                    }
                }
            }
            catch
            {
            }
        }

        private void gridds_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                int[] selectedRows = this.gridView1.GetSelectedRows();
                string s = this.gridView1.GetRowCellValue(selectedRows[0], this.gridds_id).ToString();
                string str2 = this.gridView1.GetRowCellValue(selectedRows[0], this.gridds_ma).ToString();
                this.f_setcontrol_bnkhambenh(long.Parse(s), "");
                this.txttrieuchung.Focus();
            }
            catch
            {
            }
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ucbn_khambenh));
            StyleFormatCondition condition = new StyleFormatCondition();
            this.label1 = new Label();
            this.txtmabn2 = new TextEdit();
            this.label2 = new Label();
            this.txthoten = new TextEdit();
            this.label3 = new Label();
            this.txtdiachi = new TextEdit();
            this.label4 = new Label();
            this.sbtntieptheo = new SimpleButton();
            this.sbtnluu = new SimpleButton();
            this.sbtnboqua = new SimpleButton();
            this.sbtnketthuc = new SimpleButton();
            this.label5 = new Label();
            this.txtdienthoai = new TextEdit();
            this.label6 = new Label();
            this.label7 = new Label();
            this.txtnamsinh = new TextEdit();
            this.label8 = new Label();
            this.txttuoi = new TextEdit();
            this.label9 = new Label();
            this.txtnguoithan = new TextEdit();
            this.label10 = new Label();
            this.txtnguoithanten = new TextEdit();
            this.txtnguoithanlienhe = new TextEdit();
            this.groupControl1 = new GroupControl();
            this.txtngaysinh = new MaskedTextBox();
            this.lkploaituoi = new LookUpEdit();
            this.rdbnu = new RadioButton();
            this.rdbnam = new RadioButton();
            this.btntimbn = new SimpleButton();
            this.txtmaphuongxa = new TextEdit();
            this.txttenphuongxa = new TextEdit();
            this.label11 = new Label();
            this.label30 = new Label();
            this.groupControl2 = new GroupControl();
            this.btnthembenhtat = new SimpleButton();
            this.ctrdanhsach_bsdt = new ctrdanhsach();
            this.ctrdanhsach_cdkt = new ctrdanhsach();
            this.ctrdanhsach_cd = new ctrdanhsach();
            this.clbxutri = new CheckedListBox();
            this.lkephong = new LookUpEdit();
            this.lkpdoituong = new LookUpEdit();
            this.txtcannang = new TextEdit();
            this.txthuyetap = new TextEdit();
            this.txtnhietdo = new TextEdit();
            this.txtghichu = new TextEdit();
            this.txtmabacsi = new TextEdit();
            this.txtmachandoankt = new TextEdit();
            this.txtmachandoan = new TextEdit();
            this.txtxutri = new TextEdit();
            this.txttenbacsi = new TextEdit();
            this.txttenchandoankt = new TextEdit();
            this.txttenchandoan = new TextEdit();
            this.txttrieuchung = new TextEdit();
            this.txtlydokham = new TextEdit();
            this.txtstt = new TextEdit();
            this.txtmach = new TextEdit();
            this.datengaygio = new DateEdit();
            this.label19 = new Label();
            this.label20 = new Label();
            this.label21 = new Label();
            this.label29 = new Label();
            this.label31 = new Label();
            this.label18 = new Label();
            this.label24 = new Label();
            this.label28 = new Label();
            this.label16 = new Label();
            this.label27 = new Label();
            this.label23 = new Label();
            this.label26 = new Label();
            this.label14 = new Label();
            this.label25 = new Label();
            this.label22 = new Label();
            this.label17 = new Label();
            this.label15 = new Label();
            this.label12 = new Label();
            this.label13 = new Label();
            this.groupControl3 = new GroupControl();
            this.tldk = new TreeList();
            this.tldk_ten = new TreeListColumn();
            this.repositoryItemTextEdit1 = new RepositoryItemTextEdit();
            this.tldk_idql = new TreeListColumn();
            this.tldk_id = new TreeListColumn();
            this.sbtnsua = new SimpleButton();
            this.barManager1 = new BarManager(this.components);
            this.bar1 = new Bar();
            this.bbidsbncho = new BarButtonItem();
            this.bbichidinh = new BarButtonItem();
            this.bbicaptoa = new BarButtonItem();
            this.bbitoamuangoai = new BarButtonItem();
            this.barDockControlTop = new BarDockControl();
            this.barDockControlBottom = new BarDockControl();
            this.barDockControlLeft = new BarDockControl();
            this.barDockControlRight = new BarDockControl();
            this.barStaticItem1 = new BarStaticItem();
            this.groupControl4 = new GroupControl();
            this.gridds = new GridControl();
            this.gridView1 = new GridView();
            this.gridds_ma = new GridColumn();
            this.repositoryItemTextEdit2 = new RepositoryItemTextEdit();
            this.gridds_ten = new GridColumn();
            this.gridds_id = new GridColumn();
            this.gridds_namsinh = new GridColumn();
            this.repositoryItemTextEdit3 = new RepositoryItemTextEdit();
            this.txtmabn2.Properties.BeginInit();
            this.txthoten.Properties.BeginInit();
            this.txtdiachi.Properties.BeginInit();
            this.txtdienthoai.Properties.BeginInit();
            this.txtnamsinh.Properties.BeginInit();
            this.txttuoi.Properties.BeginInit();
            this.txtnguoithan.Properties.BeginInit();
            this.txtnguoithanten.Properties.BeginInit();
            this.txtnguoithanlienhe.Properties.BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.lkploaituoi.Properties.BeginInit();
            this.txtmaphuongxa.Properties.BeginInit();
            this.txttenphuongxa.Properties.BeginInit();
            this.groupControl2.BeginInit();
            this.groupControl2.SuspendLayout();
            this.lkephong.Properties.BeginInit();
            this.lkpdoituong.Properties.BeginInit();
            this.txtcannang.Properties.BeginInit();
            this.txthuyetap.Properties.BeginInit();
            this.txtnhietdo.Properties.BeginInit();
            this.txtghichu.Properties.BeginInit();
            this.txtmabacsi.Properties.BeginInit();
            this.txtmachandoankt.Properties.BeginInit();
            this.txtmachandoan.Properties.BeginInit();
            this.txtxutri.Properties.BeginInit();
            this.txttenbacsi.Properties.BeginInit();
            this.txttenchandoankt.Properties.BeginInit();
            this.txttenchandoan.Properties.BeginInit();
            this.txttrieuchung.Properties.BeginInit();
            this.txtlydokham.Properties.BeginInit();
            this.txtstt.Properties.BeginInit();
            this.txtmach.Properties.BeginInit();
            this.datengaygio.Properties.VistaTimeProperties.BeginInit();
            this.datengaygio.Properties.BeginInit();
            this.groupControl3.BeginInit();
            this.groupControl3.SuspendLayout();
            this.tldk.BeginInit();
            this.repositoryItemTextEdit1.BeginInit();
            this.barManager1.BeginInit();
            this.groupControl4.BeginInit();
            this.groupControl4.SuspendLayout();
            this.gridds.BeginInit();
            this.gridView1.BeginInit();
            this.repositoryItemTextEdit2.BeginInit();
            this.repositoryItemTextEdit3.BeginInit();
            base.SuspendLayout();
            this.label1.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label1.Location = new Point(0x1b, 0x1f);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x40, 0x17);
            this.label1.TabIndex = 0;
            this.label1.Text = "M\x00e3 BN:";
            this.label1.TextAlign = ContentAlignment.MiddleRight;
            this.txtmabn2.Location = new Point(0x58, 0x1f);
            this.txtmabn2.Name = "txtmabn2";
            this.txtmabn2.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtmabn2.Properties.Appearance.Options.UseFont = true;
            this.txtmabn2.Properties.MaxLength = 10;
            this.txtmabn2.Size = new Size(0x6c, 0x16);
            this.txtmabn2.TabIndex = 0;
            this.txtmabn2.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmabn2.Validated += new EventHandler(this.txtmabn2_Validated);
            this.label2.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label2.Location = new Point(180, 0x1f);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x5b, 0x17);
            this.label2.TabIndex = 0;
            this.label2.Text = "Họ v\x00e0 t\x00ean:";
            this.label2.TextAlign = ContentAlignment.MiddleRight;
            this.txthoten.Location = new Point(0x10c, 0x1f);
            this.txthoten.Name = "txthoten";
            this.txthoten.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txthoten.Properties.Appearance.Options.UseFont = true;
            this.txthoten.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txthoten.Size = new Size(0x162, 0x16);
            this.txthoten.TabIndex = 1;
            this.txthoten.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label3.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label3.Location = new Point(0x18, 0x56);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x43, 0x18);
            this.label3.TabIndex = 0;
            this.label3.Text = "Địa chỉ:";
            this.label3.TextAlign = ContentAlignment.MiddleRight;
            this.txtdiachi.Location = new Point(0x59, 0x58);
            this.txtdiachi.Name = "txtdiachi";
            this.txtdiachi.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtdiachi.Properties.Appearance.Options.UseFont = true;
            this.txtdiachi.Size = new Size(0x18d, 0x16);
            this.txtdiachi.TabIndex = 8;
            this.txtdiachi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label4.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label4.Location = new Point(0x15, 0x39);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x47, 0x18);
            this.label4.TabIndex = 0;
            this.label4.Text = "Giới t\x00ednh:";
            this.label4.TextAlign = ContentAlignment.MiddleRight;
            this.sbtntieptheo.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtntieptheo.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtntieptheo.Appearance.Options.UseFont = true;
            this.sbtntieptheo.Image = (Image) manager.GetObject("sbtntieptheo.Image");
            this.sbtntieptheo.ImageLocation = ImageLocation.MiddleLeft;
            this.sbtntieptheo.Location = new Point(1, 0x1da);
            this.sbtntieptheo.Name = "sbtntieptheo";
            this.sbtntieptheo.Size = new Size(0x73, 0x17);
            this.sbtntieptheo.TabIndex = 3;
            this.sbtntieptheo.Text = "&Tiếp theo [F2]";
            this.sbtntieptheo.Click += new EventHandler(this.stbntieptheo_Click);
            this.sbtnluu.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnluu.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnluu.Appearance.Options.UseFont = true;
            this.sbtnluu.Image = Properties.Resources.imgsave;// (Image)manager.GetObject("sbtnluu.Image");
            this.sbtnluu.Location = new Point(0x77, 0x1da);
            this.sbtnluu.Name = "sbtnluu";
            this.sbtnluu.Size = new Size(80, 0x17);
            this.sbtnluu.TabIndex = 2;
            this.sbtnluu.Text = " &Lưu [F5]";
            this.sbtnluu.Click += new EventHandler(this.sbtnluu_Click);
            this.sbtnboqua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnboqua.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnboqua.Appearance.Options.UseFont = true;
            this.sbtnboqua.Image = (Image) manager.GetObject("sbtnboqua.Image");
            this.sbtnboqua.Location = new Point(0x120, 0x1da);
            this.sbtnboqua.Name = "sbtnboqua";
            this.sbtnboqua.Size = new Size(0x5c, 0x17);
            this.sbtnboqua.TabIndex = 5;
            this.sbtnboqua.Text = "&Bỏ qua [F4]";
            this.sbtnboqua.Click += new EventHandler(this.sbtnboqua_Click);
            this.sbtnketthuc.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.sbtnketthuc.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnketthuc.Appearance.Options.UseFont = true;
            this.sbtnketthuc.Image = (Image) manager.GetObject("sbtnketthuc.Image");
            this.sbtnketthuc.ImeMode = ImeMode.NoControl;
            this.sbtnketthuc.Location = new Point(0x38d, 0x1da);
            this.sbtnketthuc.Name = "sbtnketthuc";
            this.sbtnketthuc.Size = new Size(0x70, 0x17);
            this.sbtnketthuc.TabIndex = 7;
            this.sbtnketthuc.Text = "&Kết th\x00fac [F12]";
            this.sbtnketthuc.Click += new EventHandler(this.stbnketthuc_Click);
            this.label5.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label5.Location = new Point(0x1e6, 0x57);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x2b, 0x19);
            this.label5.TabIndex = 0;
            this.label5.Text = "ĐT:";
            this.label5.TextAlign = ContentAlignment.MiddleRight;
            this.txtdienthoai.Location = new Point(0x20c, 0x57);
            this.txtdienthoai.Name = "txtdienthoai";
            this.txtdienthoai.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtdienthoai.Properties.Appearance.Options.UseFont = true;
            this.txtdienthoai.Size = new Size(0x62, 0x16);
            this.txtdienthoai.TabIndex = 9;
            this.txtdienthoai.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label6.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label6.Location = new Point(180, 0x3b);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x5b, 0x16);
            this.label6.TabIndex = 6;
            this.label6.Text = "Ng\x00e0y sinh:";
            this.label6.TextAlign = ContentAlignment.MiddleRight;
            this.label7.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label7.Location = new Point(0x162, 0x3b);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x5b, 0x16);
            this.label7.TabIndex = 0;
            this.label7.Text = "Năm sinh:";
            this.label7.TextAlign = ContentAlignment.MiddleRight;
            this.txtnamsinh.Location = new Point(0x1ba, 0x3b);
            this.txtnamsinh.Name = "txtnamsinh";
            this.txtnamsinh.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtnamsinh.Properties.Appearance.Options.UseFont = true;
            this.txtnamsinh.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtnamsinh.Properties.MaxLength = 4;
            this.txtnamsinh.Size = new Size(0x2c, 0x16);
            this.txtnamsinh.TabIndex = 5;
            this.txtnamsinh.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtnamsinh.Validated += new EventHandler(this.txtnamsinh_Validated);
            this.label8.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label8.Location = new Point(0x1e3, 0x3b);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x2e, 0x16);
            this.label8.TabIndex = 0;
            this.label8.Text = "Tuổi:";
            this.label8.TextAlign = ContentAlignment.MiddleRight;
            this.txttuoi.Location = new Point(0x20c, 0x3b);
            this.txttuoi.Name = "txttuoi";
            this.txttuoi.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txttuoi.Properties.Appearance.Options.UseFont = true;
            this.txttuoi.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txttuoi.Size = new Size(0x1b, 0x16);
            this.txttuoi.TabIndex = 6;
            this.txttuoi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txttuoi.Validated += new EventHandler(this.txttuoi_Validated);
            this.label9.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label9.Location = new Point(5, 140);
            this.label9.Name = "label9";
            this.label9.Size = new Size(0x56, 0x18);
            this.label9.TabIndex = 0;
            this.label9.Text = "Người th\x00e2n:";
            this.label9.TextAlign = ContentAlignment.MiddleRight;
            this.txtnguoithan.Location = new Point(0x58, 0x8e);
            this.txtnguoithan.Name = "txtnguoithan";
            this.txtnguoithan.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtnguoithan.Properties.Appearance.Options.UseFont = true;
            this.txtnguoithan.Size = new Size(0x2f, 0x16);
            this.txtnguoithan.TabIndex = 12;
            this.txtnguoithan.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label10.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label10.Location = new Point(0x84, 0x8d);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x40, 0x18);
            this.label10.TabIndex = 0;
            this.label10.Text = "Họ t\x00ean:";
            this.label10.TextAlign = ContentAlignment.MiddleRight;
            this.txtnguoithanten.Location = new Point(0xc0, 0x8d);
            this.txtnguoithanten.Name = "txtnguoithanten";
            this.txtnguoithanten.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtnguoithanten.Properties.Appearance.Options.UseFont = true;
            this.txtnguoithanten.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtnguoithanten.Size = new Size(0xa2, 0x16);
            this.txtnguoithanten.TabIndex = 13;
            this.txtnguoithanten.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtnguoithanlienhe.Location = new Point(0x1ba, 0x8d);
            this.txtnguoithanlienhe.Name = "txtnguoithanlienhe";
            this.txtnguoithanlienhe.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtnguoithanlienhe.Properties.Appearance.Options.UseFont = true;
            this.txtnguoithanlienhe.Size = new Size(180, 0x16);
            this.txtnguoithanlienhe.TabIndex = 14;
            this.txtnguoithanlienhe.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.groupControl1.Appearance.Font = new Font("Tahoma", 10f);
            this.groupControl1.Appearance.Options.UseFont = true;
            this.groupControl1.AppearanceCaption.BackColor = Color.FromArgb(0xe3, 0xef, 0xff);
            this.groupControl1.AppearanceCaption.Font = new Font("Tahoma", 12f, FontStyle.Bold);
            this.groupControl1.AppearanceCaption.Options.UseBackColor = true;
            this.groupControl1.AppearanceCaption.Options.UseFont = true;
            this.groupControl1.Controls.Add(this.txtngaysinh);
            this.groupControl1.Controls.Add(this.lkploaituoi);
            this.groupControl1.Controls.Add(this.rdbnu);
            this.groupControl1.Controls.Add(this.rdbnam);
            this.groupControl1.Controls.Add(this.txthoten);
            this.groupControl1.Controls.Add(this.label6);
            this.groupControl1.Controls.Add(this.btntimbn);
            this.groupControl1.Controls.Add(this.txtnguoithanlienhe);
            this.groupControl1.Controls.Add(this.label4);
            this.groupControl1.Controls.Add(this.txtdienthoai);
            this.groupControl1.Controls.Add(this.txtnguoithanten);
            this.groupControl1.Controls.Add(this.txtmaphuongxa);
            this.groupControl1.Controls.Add(this.txttenphuongxa);
            this.groupControl1.Controls.Add(this.txtnguoithan);
            this.groupControl1.Controls.Add(this.txtmabn2);
            this.groupControl1.Controls.Add(this.txtdiachi);
            this.groupControl1.Controls.Add(this.txtnamsinh);
            this.groupControl1.Controls.Add(this.txttuoi);
            this.groupControl1.Controls.Add(this.label11);
            this.groupControl1.Controls.Add(this.label10);
            this.groupControl1.Controls.Add(this.label9);
            this.groupControl1.Controls.Add(this.label3);
            this.groupControl1.Controls.Add(this.label2);
            this.groupControl1.Controls.Add(this.label5);
            this.groupControl1.Controls.Add(this.label7);
            this.groupControl1.Controls.Add(this.label8);
            this.groupControl1.Controls.Add(this.label1);
            this.groupControl1.Controls.Add(this.label30);
            this.groupControl1.Location = new Point(0xe7, 30);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x273, 0xa7);
            this.groupControl1.TabIndex = 0;
            this.groupControl1.Text = "Th\x00f4ng tin h\x00e0nh ch\x00ednh";
            this.txtngaysinh.Font = new Font("Tahoma", 10f);
            this.txtngaysinh.Location = new Point(0x10c, 0x39);
            this.txtngaysinh.Mask = "00/00/0000";
            this.txtngaysinh.Name = "txtngaysinh";
            this.txtngaysinh.Size = new Size(0x56, 0x18);
            this.txtngaysinh.TabIndex = 4;
            this.txtngaysinh.ValidatingType = typeof(DateTime);
            this.txtngaysinh.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtngaysinh.Validated += new EventHandler(this.txtngaysinh_Validated);
            this.lkploaituoi.Location = new Point(0x228, 0x3b);
            this.lkploaituoi.Name = "lkploaituoi";
            this.lkploaituoi.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.lkploaituoi.Properties.Appearance.Options.UseFont = true;
            this.lkploaituoi.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.lkploaituoi.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id", 20, FormatType.None, "", false, HorzAlignment.Default), new LookUpColumnInfo("ten", "Tuổi") });
            this.lkploaituoi.Properties.NullText = "";
            this.lkploaituoi.Size = new Size(70, 0x16);
            this.lkploaituoi.TabIndex = 7;
            this.lkploaituoi.EditValueChanged += new EventHandler(this.lkploaituoi_EditValueChanged);
            this.lkploaituoi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.rdbnu.AutoSize = true;
            this.rdbnu.Font = new Font("Tahoma", 10f);
            this.rdbnu.Location = new Point(0x91, 60);
            this.rdbnu.Name = "rdbnu";
            this.rdbnu.Size = new Size(0x2c, 0x15);
            this.rdbnu.TabIndex = 3;
            this.rdbnu.Text = "Nữ";
            this.rdbnu.UseVisualStyleBackColor = true;
            this.rdbnu.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.rdbnam.AutoSize = true;
            this.rdbnam.Checked = true;
            this.rdbnam.Font = new Font("Tahoma", 10f);
            this.rdbnam.Location = new Point(0x59, 0x3b);
            this.rdbnam.Name = "rdbnam";
            this.rdbnam.Size = new Size(0x36, 0x15);
            this.rdbnam.TabIndex = 2;
            this.rdbnam.TabStop = true;
            this.rdbnam.Text = "Nam";
            this.rdbnam.UseVisualStyleBackColor = true;
            this.rdbnam.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.btntimbn.Appearance.Font = new Font("Tahoma", 10f);
            this.btntimbn.Appearance.Options.UseFont = true;
            this.btntimbn.Image = (Image) manager.GetObject("btntimbn.Image");
            this.btntimbn.Location = new Point(11, 30);
            this.btntimbn.Name = "btntimbn";
            this.btntimbn.Size = new Size(0x16, 0x17);
            this.btntimbn.TabIndex = 5;
            this.btntimbn.ToolTip = "T\x00ecm th\x00f4ng tin bệnh nh\x00e2n";
            this.btntimbn.Click += new EventHandler(this.btntimbn_Click);
            this.txtmaphuongxa.Location = new Point(0x59, 0x73);
            this.txtmaphuongxa.Name = "txtmaphuongxa";
            this.txtmaphuongxa.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txtmaphuongxa.Properties.Appearance.Options.UseFont = true;
            this.txtmaphuongxa.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtmaphuongxa.Size = new Size(0x67, 0x16);
            this.txtmaphuongxa.TabIndex = 10;
            this.txtmaphuongxa.ToolTipTitle = "M\x00e3 viết tắt";
            this.txtmaphuongxa.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmaphuongxa.Validated += new EventHandler(this.txtmaphuongxa_Validated);
            this.txttenphuongxa.Location = new Point(0xc0, 0x73);
            this.txttenphuongxa.Name = "txttenphuongxa";
            this.txttenphuongxa.Properties.Appearance.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.txttenphuongxa.Properties.Appearance.Options.UseFont = true;
            this.txttenphuongxa.Size = new Size(430, 0x16);
            this.txttenphuongxa.TabIndex = 11;
            this.txttenphuongxa.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label11.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label11.Location = new Point(0x16c, 0x8e);
            this.label11.Name = "label11";
            this.label11.Size = new Size(0x4b, 0x17);
            this.label11.TabIndex = 0;
            this.label11.Text = "Li\x00ean hệ:";
            this.label11.TextAlign = ContentAlignment.MiddleRight;
            this.label30.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label30.Location = new Point(0x24, 0x71);
            this.label30.Name = "label30";
            this.label30.Size = new Size(0x31, 0x16);
            this.label30.TabIndex = 6;
            this.label30.Text = "T/P/X:";
            this.label30.TextAlign = ContentAlignment.MiddleRight;
            this.groupControl2.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupControl2.AppearanceCaption.Font = new Font("Tahoma", 12f, FontStyle.Bold);
            this.groupControl2.AppearanceCaption.Options.UseFont = true;
            this.groupControl2.Controls.Add(this.btnthembenhtat);
            this.groupControl2.Controls.Add(this.ctrdanhsach_bsdt);
            this.groupControl2.Controls.Add(this.ctrdanhsach_cdkt);
            this.groupControl2.Controls.Add(this.ctrdanhsach_cd);
            this.groupControl2.Controls.Add(this.clbxutri);
            this.groupControl2.Controls.Add(this.lkephong);
            this.groupControl2.Controls.Add(this.lkpdoituong);
            this.groupControl2.Controls.Add(this.txtcannang);
            this.groupControl2.Controls.Add(this.txthuyetap);
            this.groupControl2.Controls.Add(this.txtnhietdo);
            this.groupControl2.Controls.Add(this.txtghichu);
            this.groupControl2.Controls.Add(this.txtmabacsi);
            this.groupControl2.Controls.Add(this.txtmachandoankt);
            this.groupControl2.Controls.Add(this.txtmachandoan);
            this.groupControl2.Controls.Add(this.txtxutri);
            this.groupControl2.Controls.Add(this.txttenbacsi);
            this.groupControl2.Controls.Add(this.txttenchandoankt);
            this.groupControl2.Controls.Add(this.txttenchandoan);
            this.groupControl2.Controls.Add(this.txttrieuchung);
            this.groupControl2.Controls.Add(this.txtlydokham);
            this.groupControl2.Controls.Add(this.txtstt);
            this.groupControl2.Controls.Add(this.txtmach);
            this.groupControl2.Controls.Add(this.datengaygio);
            this.groupControl2.Controls.Add(this.label19);
            this.groupControl2.Controls.Add(this.label20);
            this.groupControl2.Controls.Add(this.label21);
            this.groupControl2.Controls.Add(this.label29);
            this.groupControl2.Controls.Add(this.label31);
            this.groupControl2.Controls.Add(this.label18);
            this.groupControl2.Controls.Add(this.label24);
            this.groupControl2.Controls.Add(this.label28);
            this.groupControl2.Controls.Add(this.label16);
            this.groupControl2.Controls.Add(this.label27);
            this.groupControl2.Controls.Add(this.label23);
            this.groupControl2.Controls.Add(this.label26);
            this.groupControl2.Controls.Add(this.label14);
            this.groupControl2.Controls.Add(this.label25);
            this.groupControl2.Controls.Add(this.label22);
            this.groupControl2.Controls.Add(this.label17);
            this.groupControl2.Controls.Add(this.label15);
            this.groupControl2.Controls.Add(this.label12);
            this.groupControl2.Controls.Add(this.label13);
            this.groupControl2.Location = new Point(0xe7, 0xc7);
            this.groupControl2.Name = "groupControl2";
            this.groupControl2.Size = new Size(0x273, 270);
            this.groupControl2.TabIndex = 1;
            this.groupControl2.Text = "Th\x00f4ng tin kh\x00e1m bệnh";
            this.btnthembenhtat.Location = new Point(0x259, 0x91);
            this.btnthembenhtat.Name = "btnthembenhtat";
            this.btnthembenhtat.Size = new Size(0x16, 0x15);
            this.btnthembenhtat.TabIndex = 0x2b;
            this.btnthembenhtat.Text = "...";
            this.btnthembenhtat.Click += new EventHandler(this.btnthembenhtat_Click);
            this.ctrdanhsach_bsdt.ChieuRongTuDong = true;
            this.ctrdanhsach_bsdt.DanhSachCotHienThi = "";
            this.ctrdanhsach_bsdt.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_bsdt.Location = new Point(8, 0xc9);
            this.ctrdanhsach_bsdt.Name = "ctrdanhsach_bsdt";
            this.ctrdanhsach_bsdt.pRowsCountDown = 5;
            this.ctrdanhsach_bsdt.Size = new Size(0x1d, 0x13);
            this.ctrdanhsach_bsdt.TabIndex = 0x12;
            this.ctrdanhsach_bsdt.Visible = false;
            this.ctrdanhsach_bsdt.Validated += new EventHandler(this.ctrdanhsach_bsdt_Validated);
            this.ctrdanhsach_cdkt.ChieuRongTuDong = true;
            this.ctrdanhsach_cdkt.DanhSachCotHienThi = "";
            this.ctrdanhsach_cdkt.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_cdkt.Location = new Point(8, 0xb0);
            this.ctrdanhsach_cdkt.Name = "ctrdanhsach_cdkt";
            this.ctrdanhsach_cdkt.pRowsCountDown = 5;
            this.ctrdanhsach_cdkt.Size = new Size(0x1d, 0x13);
            this.ctrdanhsach_cdkt.TabIndex = 15;
            this.ctrdanhsach_cdkt.Visible = false;
            this.ctrdanhsach_cdkt.Validated += new EventHandler(this.ctrdanhsach_cdkt_Validated);
            this.ctrdanhsach_cd.ChieuRongTuDong = true;
            this.ctrdanhsach_cd.DanhSachCotHienThi = "";
            this.ctrdanhsach_cd.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_cd.Location = new Point(5, 0x94);
            this.ctrdanhsach_cd.Name = "ctrdanhsach_cd";
            this.ctrdanhsach_cd.pRowsCountDown = 5;
            this.ctrdanhsach_cd.Size = new Size(0x1d, 0x13);
            this.ctrdanhsach_cd.TabIndex = 12;
            this.ctrdanhsach_cd.Visible = false;
            this.ctrdanhsach_cd.Validated += new EventHandler(this.ctrdanhsach_cd_Validated);
            this.clbxutri.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.clbxutri.FormattingEnabled = true;
            this.clbxutri.Items.AddRange(new object[] { "01 Cấp toa cho về", "02 Điều trị ngoại tr\x00fa", "03 Nhập viện", "04 Kh\x00e1c" });
            this.clbxutri.Location = new Point(0x1b9, 0xe0);
            this.clbxutri.Name = "clbxutri";
            this.clbxutri.Size = new Size(0xb5, 0x24);
            this.clbxutri.TabIndex = 0x16;
            this.clbxutri.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbxutri_ItemCheck);
            this.clbxutri.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.lkephong.Location = new Point(0x1b3, 0x1f);
            this.lkephong.Name = "lkephong";
            this.lkephong.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.lkephong.Properties.Appearance.Options.UseFont = true;
            this.lkephong.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.lkephong.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id", 20, FormatType.None, "", false, HorzAlignment.Default), new LookUpColumnInfo("ten", "T\x00ean") });
            this.lkephong.Properties.NullText = "";
            this.lkephong.Size = new Size(0xbb, 0x16);
            this.lkephong.TabIndex = 2;
            this.lkephong.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.lkpdoituong.Location = new Point(0x11d, 0x1f);
            this.lkpdoituong.Name = "lkpdoituong";
            this.lkpdoituong.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.lkpdoituong.Properties.Appearance.Options.UseFont = true;
            this.lkpdoituong.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.lkpdoituong.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id", 20, FormatType.None, "", false, HorzAlignment.Default), new LookUpColumnInfo("ten", "Đối tượng") });
            this.lkpdoituong.Properties.NullText = "";
            this.lkpdoituong.Size = new Size(0x45, 0x16);
            this.lkpdoituong.TabIndex = 1;
            this.lkpdoituong.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtcannang.Location = new Point(0x243, 60);
            this.txtcannang.Name = "txtcannang";
            this.txtcannang.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtcannang.Properties.Appearance.Options.UseFont = true;
            this.txtcannang.Size = new Size(0x16, 0x16);
            this.txtcannang.TabIndex = 6;
            this.txtcannang.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txthuyetap.Location = new Point(0x1b3, 60);
            this.txthuyetap.Name = "txthuyetap";
            this.txthuyetap.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txthuyetap.Properties.Appearance.Options.UseFont = true;
            this.txthuyetap.Size = new Size(0x36, 0x16);
            this.txthuyetap.TabIndex = 5;
            this.txthuyetap.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtnhietdo.Location = new Point(0x11d, 60);
            this.txtnhietdo.Name = "txtnhietdo";
            this.txtnhietdo.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtnhietdo.Properties.Appearance.Options.UseFont = true;
            this.txtnhietdo.Size = new Size(0x27, 0x16);
            this.txtnhietdo.TabIndex = 4;
            this.txtnhietdo.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtghichu.EditValue = "";
            this.txtghichu.Location = new Point(0x58, 0xe5);
            this.txtghichu.Name = "txtghichu";
            this.txtghichu.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtghichu.Properties.Appearance.Options.UseFont = true;
            this.txtghichu.Size = new Size(0x124, 0x16);
            this.txtghichu.TabIndex = 20;
            this.txtghichu.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtghichu.Validated += new EventHandler(this.txtghichu_Validated);
            this.txtmabacsi.EditValue = "";
            this.txtmabacsi.Location = new Point(0x58, 0xc9);
            this.txtmabacsi.Name = "txtmabacsi";
            this.txtmabacsi.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtmabacsi.Properties.Appearance.Options.UseFont = true;
            this.txtmabacsi.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtmabacsi.Size = new Size(0x4d, 0x16);
            this.txtmabacsi.TabIndex = 0x10;
            this.txtmabacsi.Enter += new EventHandler(this.txttenbacsi_Enter);
            this.txtmabacsi.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmabacsi.Validated += new EventHandler(this.txtmabacsi_Validated);
            this.txtmachandoankt.EditValue = "";
            this.txtmachandoankt.Location = new Point(0x58, 0xad);
            this.txtmachandoankt.Name = "txtmachandoankt";
            this.txtmachandoankt.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtmachandoankt.Properties.Appearance.Options.UseFont = true;
            this.txtmachandoankt.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtmachandoankt.Size = new Size(0x4d, 0x16);
            this.txtmachandoankt.TabIndex = 13;
            this.txtmachandoankt.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmachandoankt.Validated += new EventHandler(this.txtmachandoankt_Validated);
            this.txtmachandoan.EditValue = "";
            this.txtmachandoan.Location = new Point(0x58, 0x91);
            this.txtmachandoan.Name = "txtmachandoan";
            this.txtmachandoan.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtmachandoan.Properties.Appearance.Options.UseFont = true;
            this.txtmachandoan.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtmachandoan.Size = new Size(0x4d, 0x16);
            this.txtmachandoan.TabIndex = 10;
            this.txtmachandoan.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmachandoan.Validated += new EventHandler(this.txtmachandoan_Validated);
            this.txtxutri.EditValue = "";
            this.txtxutri.Location = new Point(0x1b9, 0xc9);
            this.txtxutri.Name = "txtxutri";
            this.txtxutri.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtxutri.Properties.Appearance.Options.UseFont = true;
            this.txtxutri.Size = new Size(0xb5, 0x16);
            this.txtxutri.TabIndex = 0x13;
            this.txtxutri.EditValueChanged += new EventHandler(this.txtxutri_EditValueChanged);
            this.txtxutri.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txttenbacsi.EditValue = "";
            this.txttenbacsi.Location = new Point(0xa6, 0xc9);
            this.txttenbacsi.Name = "txttenbacsi";
            this.txttenbacsi.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txttenbacsi.Properties.Appearance.Options.UseFont = true;
            this.txttenbacsi.Size = new Size(0xd6, 0x16);
            this.txttenbacsi.TabIndex = 0x11;
            this.txttenbacsi.TextChanged += new EventHandler(this.txttenbacsi_TextChanged);
            this.txttenbacsi.Enter += new EventHandler(this.txttenbacsi_Enter);
            this.txttenbacsi.KeyDown += new KeyEventHandler(this.txttenbacsi_KeyDown);
            this.txttenchandoankt.EditValue = "";
            this.txttenchandoankt.Location = new Point(0xa6, 0xad);
            this.txttenchandoankt.Name = "txttenchandoankt";
            this.txttenchandoankt.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txttenchandoankt.Properties.Appearance.Options.UseFont = true;
            this.txttenchandoankt.Size = new Size(0x1c8, 0x16);
            this.txttenchandoankt.TabIndex = 14;
            this.txttenchandoankt.TextChanged += new EventHandler(this.txttenchandoankt_TextChanged);
            this.txttenchandoankt.Enter += new EventHandler(this.txttenchandoankt_Enter);
            this.txttenchandoankt.KeyDown += new KeyEventHandler(this.txttenchandoankt_KeyDown);
            this.txttenchandoan.EditValue = "";
            this.txttenchandoan.Location = new Point(0xa6, 0x91);
            this.txttenchandoan.Name = "txttenchandoan";
            this.txttenchandoan.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txttenchandoan.Properties.Appearance.Options.UseFont = true;
            this.txttenchandoan.Size = new Size(0x1b3, 0x16);
            this.txttenchandoan.TabIndex = 11;
            this.txttenchandoan.TextChanged += new EventHandler(this.txttenchandoan_TextChanged);
            this.txttenchandoan.Enter += new EventHandler(this.txttenchandoan_Enter);
            this.txttenchandoan.KeyDown += new KeyEventHandler(this.txttenchandoan_KeyDown);
            this.txttrieuchung.EditValue = "";
            this.txttrieuchung.Location = new Point(0x58, 0x75);
            this.txttrieuchung.Name = "txttrieuchung";
            this.txttrieuchung.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txttrieuchung.Properties.Appearance.Options.UseFont = true;
            this.txttrieuchung.Size = new Size(0x216, 0x16);
            this.txttrieuchung.TabIndex = 9;
            this.txttrieuchung.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txttrieuchung.Validated += new EventHandler(this.txttrieuchung_Validated);
            this.txtlydokham.EditValue = "";
            this.txtlydokham.Location = new Point(0x11d, 0x59);
            this.txtlydokham.Name = "txtlydokham";
            this.txtlydokham.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtlydokham.Properties.Appearance.Options.UseFont = true;
            this.txtlydokham.Size = new Size(0x151, 0x16);
            this.txtlydokham.TabIndex = 8;
            this.txtlydokham.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtstt.EditValue = "0";
            this.txtstt.Location = new Point(0x58, 0x59);
            this.txtstt.Name = "txtstt";
            this.txtstt.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtstt.Properties.Appearance.Options.UseFont = true;
            this.txtstt.Size = new Size(0x2f, 0x16);
            this.txtstt.TabIndex = 7;
            this.txtstt.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmach.Location = new Point(0x58, 60);
            this.txtmach.Name = "txtmach";
            this.txtmach.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.txtmach.Properties.Appearance.Options.UseFont = true;
            this.txtmach.Size = new Size(0x2f, 0x16);
            this.txtmach.TabIndex = 3;
            this.txtmach.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.datengaygio.EditValue = new DateTime(0x7dd, 9, 15, 2, 20, 5, 0x13f);
            this.datengaygio.Location = new Point(0x58, 0x1f);
            this.datengaygio.Name = "datengaygio";
            this.datengaygio.Properties.Appearance.Font = new Font("Tahoma", 10f);
            this.datengaygio.Properties.Appearance.Options.UseFont = true;
            this.datengaygio.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datengaygio.Properties.DisplayFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengaygio.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datengaygio.Properties.EditFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengaygio.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datengaygio.Properties.Mask.EditMask = "dd/MM/yyyy HH:mm";
            this.datengaygio.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datengaygio.Size = new Size(0x7f, 20);
            this.datengaygio.TabIndex = 0;
            this.datengaygio.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.label19.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label19.Location = new Point(0x214, 60);
            this.label19.Name = "label19";
            this.label19.Size = new Size(50, 0x17);
            this.label19.TabIndex = 0;
            this.label19.Text = "Nặng:";
            this.label19.TextAlign = ContentAlignment.MiddleRight;
            this.label20.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label20.Location = new Point(600, 60);
            this.label20.Name = "label20";
            this.label20.Size = new Size(0x17, 0x17);
            this.label20.TabIndex = 0;
            this.label20.Text = "kg";
            this.label20.TextAlign = ContentAlignment.MiddleLeft;
            this.label21.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label21.Location = new Point(0x1e9, 60);
            this.label21.Name = "label21";
            this.label21.Size = new Size(0x33, 0x17);
            this.label21.TabIndex = 0;
            this.label21.Text = "mmHg";
            this.label21.TextAlign = ContentAlignment.MiddleLeft;
            this.label29.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label29.Location = new Point(0x17e, 0xc9);
            this.label29.Name = "label29";
            this.label29.Size = new Size(0x3e, 0x17);
            this.label29.TabIndex = 0;
            this.label29.Text = "*Xử tr\x00ed:";
            this.label29.TextAlign = ContentAlignment.MiddleRight;
            this.label31.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label31.Location = new Point(1, 0xe5);
            this.label31.Name = "label31";
            this.label31.Size = new Size(90, 0x16);
            this.label31.TabIndex = 0;
            this.label31.Text = "Lời dặn:";
            this.label31.TextAlign = ContentAlignment.MiddleRight;
            this.label18.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label18.Location = new Point(0x170, 60);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x45, 0x17);
            this.label18.TabIndex = 0;
            this.label18.Text = "Huyết \x00e1p:";
            this.label18.TextAlign = ContentAlignment.MiddleRight;
            this.label24.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label24.Location = new Point(0x145, 0x3b);
            this.label24.Name = "label24";
            this.label24.Size = new Size(0x1a, 0x17);
            this.label24.TabIndex = 0;
            this.label24.Text = "\x00b0C";
            this.label24.TextAlign = ContentAlignment.MiddleLeft;
            this.label28.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label28.Location = new Point(1, 200);
            this.label28.Name = "label28";
            this.label28.Size = new Size(90, 0x17);
            this.label28.TabIndex = 0;
            this.label28.Text = "*B\x00e1c sĩ điều trị:";
            this.label28.TextAlign = ContentAlignment.MiddleRight;
            this.label16.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label16.Location = new Point(0xd8, 60);
            this.label16.Name = "label16";
            this.label16.Size = new Size(0x48, 0x17);
            this.label16.TabIndex = 0;
            this.label16.Text = "Nhiệt độ:";
            this.label16.TextAlign = ContentAlignment.MiddleRight;
            this.label27.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label27.Location = new Point(1, 0xac);
            this.label27.Name = "label27";
            this.label27.Size = new Size(90, 0x17);
            this.label27.TabIndex = 0;
            this.label27.Text = "Tiền sử bệnh:";
            this.label27.TextAlign = ContentAlignment.MiddleRight;
            this.label23.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label23.Location = new Point(0xbc, 0x59);
            this.label23.Name = "label23";
            this.label23.Size = new Size(100, 0x17);
            this.label23.TabIndex = 0;
            this.label23.Text = "L\x00fd do kh\x00e1m:";
            this.label23.TextAlign = ContentAlignment.MiddleRight;
            this.label26.Font = new Font("Microsoft Sans Serif", 8f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label26.Location = new Point(1, 0x92);
            this.label26.Name = "label26";
            this.label26.Size = new Size(90, 0x17);
            this.label26.TabIndex = 0;
            this.label26.Text = "*Chẩn đo\x00e1n:";
            this.label26.TextAlign = ContentAlignment.MiddleRight;
            this.label14.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label14.Location = new Point(0x16b, 0x1f);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0x4b, 0x17);
            this.label14.TabIndex = 0;
            this.label14.Text = "K/Ph\x00f2ng:";
            this.label14.TextAlign = ContentAlignment.MiddleRight;
            this.label25.Font = new Font("Microsoft Sans Serif", 8f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label25.Location = new Point(1, 0x75);
            this.label25.Name = "label25";
            this.label25.Size = new Size(90, 0x17);
            this.label25.TabIndex = 0;
            this.label25.Text = "Triệu chứng:";
            this.label25.TextAlign = ContentAlignment.MiddleRight;
            this.label22.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label22.Location = new Point(0x18, 0x59);
            this.label22.Name = "label22";
            this.label22.Size = new Size(0x42, 0x17);
            this.label22.TabIndex = 0;
            this.label22.Text = "STT:";
            this.label22.TextAlign = ContentAlignment.MiddleRight;
            this.label17.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label17.Location = new Point(0x87, 60);
            this.label17.Name = "label17";
            this.label17.Size = new Size(0x3f, 0x17);
            this.label17.TabIndex = 0;
            this.label17.Text = "lần/ph\x00fat";
            this.label17.TextAlign = ContentAlignment.MiddleLeft;
            this.label15.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label15.Location = new Point(0x1b, 60);
            this.label15.Name = "label15";
            this.label15.Size = new Size(0x40, 0x17);
            this.label15.TabIndex = 0;
            this.label15.Text = "Mạch:";
            this.label15.TextAlign = ContentAlignment.MiddleRight;
            this.label12.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label12.Location = new Point(5, 0x1f);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x56, 0x17);
            this.label12.TabIndex = 0;
            this.label12.Text = "Ng\x00e0y giờ:";
            this.label12.TextAlign = ContentAlignment.MiddleRight;
            this.label13.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label13.Location = new Point(0xd5, 0x1f);
            this.label13.Name = "label13";
            this.label13.Size = new Size(0x4b, 0x17);
            this.label13.TabIndex = 0;
            this.label13.Text = "Đối tượng:";
            this.label13.TextAlign = ContentAlignment.MiddleRight;
            this.groupControl3.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupControl3.AppearanceCaption.Font = new Font("Tahoma", 12f, FontStyle.Bold);
            this.groupControl3.AppearanceCaption.Options.UseFont = true;
            this.groupControl3.Controls.Add(this.tldk);
            this.groupControl3.Location = new Point(0x35b, 30);
            this.groupControl3.Name = "groupControl3";
            this.groupControl3.Size = new Size(0xa4, 0x1b7);
            this.groupControl3.TabIndex = 6;
            this.groupControl3.Text = "C\x00e1c lần kh\x00e1m bệnh";
            this.tldk.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.tldk.Columns.AddRange(new TreeListColumn[] { this.tldk_ten, this.tldk_idql, this.tldk_id });
            this.tldk.Location = new Point(0, 0x1c);
            this.tldk.Name = "tldk";
            this.tldk.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit1 });
            this.tldk.Size = new Size(0xa2, 0x197);
            this.tldk.TabIndex = 0;
            this.tldk.FocusedNodeChanged += new FocusedNodeChangedEventHandler(this.tldk_FocusedNodeChanged);
            this.tldk.Click += new EventHandler(this.tldk_Click);
            this.tldk.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.tldk_ten.Caption = "Ng\x00e0y";
            this.tldk_ten.ColumnEdit = this.repositoryItemTextEdit1;
            this.tldk_ten.FieldName = "ngay";
            this.tldk_ten.Name = "tldk_ten";
            this.tldk_ten.OptionsColumn.AllowEdit = false;
            this.tldk_ten.Visible = true;
            this.tldk_ten.VisibleIndex = 0;
            this.repositoryItemTextEdit1.AutoHeight = false;
            this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1";
            this.repositoryItemTextEdit1.ReadOnly = true;
            this.tldk_idql.Caption = "idql";
            this.tldk_idql.ColumnEdit = this.repositoryItemTextEdit1;
            this.tldk_idql.FieldName = "idql";
            this.tldk_idql.Name = "tldk_idql";
            this.tldk_idql.OptionsColumn.AllowEdit = false;
            this.tldk_id.Caption = "tldk_id";
            this.tldk_id.FieldName = "tldk_id";
            this.tldk_id.Name = "tldk_id";
            this.sbtnsua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.sbtnsua.Appearance.Font = new Font("Tahoma", 10f);
            this.sbtnsua.Appearance.Options.UseFont = true;
            this.sbtnsua.Image = (Image) manager.GetObject("sbtnsua.Image");
            this.sbtnsua.Location = new Point(0xca, 0x1da);
            this.sbtnsua.Name = "sbtnsua";
            this.sbtnsua.Size = new Size(0x52, 0x17);
            this.sbtnsua.TabIndex = 4;
            this.sbtnsua.Text = "&Sửa [F3]";
            this.sbtnsua.Click += new EventHandler(this.sbtnsua_Click);
            this.barManager1.Bars.AddRange(new Bar[] { this.bar1 });
            this.barManager1.DockControls.Add(this.barDockControlTop);
            this.barManager1.DockControls.Add(this.barDockControlBottom);
            this.barManager1.DockControls.Add(this.barDockControlLeft);
            this.barManager1.DockControls.Add(this.barDockControlRight);
            this.barManager1.Form = this;
            this.barManager1.Items.AddRange(new BarItem[] { this.barStaticItem1, this.bbichidinh, this.bbicaptoa, this.bbidsbncho, this.bbitoamuangoai });
            this.barManager1.MaxItemId = 5;
            this.bar1.BarName = "Tools";
            this.bar1.DockCol = 0;
            this.bar1.DockRow = 0;
            this.bar1.DockStyle = BarDockStyle.Top;
            this.bar1.LinksPersistInfo.AddRange(new LinkPersistInfo[] { new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbidsbncho, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbichidinh, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbicaptoa, "", true, true, true, 0, null, BarItemPaintStyle.CaptionGlyph), new LinkPersistInfo(BarLinkUserDefines.PaintStyle, this.bbitoamuangoai, BarItemPaintStyle.CaptionGlyph) });
            this.bar1.OptionsBar.AllowQuickCustomization = false;
            this.bar1.Text = "Tools";
            this.bbidsbncho.Caption = "Danh s\x00e1ch chờ kh\x00e1m [F10]";
            this.bbidsbncho.Glyph = (Image) manager.GetObject("bbidsbncho.Glyph");
            this.bbidsbncho.Id = 3;
            this.bbidsbncho.Name = "bbidsbncho";
            this.bbidsbncho.ItemClick += new ItemClickEventHandler(this.bbidsbncho_ItemClick);
            this.bbichidinh.AllowRightClickInMenu = false;
            this.bbichidinh.Caption = "[F7]  Chỉ định dịch vụ";
            this.bbichidinh.Id = 1;
            this.bbichidinh.ItemAppearance.Normal.ForeColor = Color.Blue;
            this.bbichidinh.ItemAppearance.Normal.Options.UseForeColor = true;
            this.bbichidinh.ItemShortcut = new BarShortcut(Keys.F7);
            this.bbichidinh.Name = "bbichidinh";
            this.bbichidinh.ItemClick += new ItemClickEventHandler(this.bbichidinh_ItemClick);
            this.bbicaptoa.Caption = "[F8] Cấp toa thuốc";
            this.bbicaptoa.Glyph = (Image) manager.GetObject("bbicaptoa.Glyph");
            this.bbicaptoa.Id = 2;
            this.bbicaptoa.ItemAppearance.Normal.ForeColor = Color.Blue;
            this.bbicaptoa.ItemAppearance.Normal.Options.UseForeColor = true;
            this.bbicaptoa.ItemShortcut = new BarShortcut(Keys.F8);
            this.bbicaptoa.Name = "bbicaptoa";
            this.bbicaptoa.ItemClick += new ItemClickEventHandler(this.bbicaptoa_ItemClick);
            this.bbitoamuangoai.Caption = "[F9] Cấp toa mua ngo\x00e0i";
            this.bbitoamuangoai.Glyph = (Image) manager.GetObject("bbitoamuangoai.Glyph");
            this.bbitoamuangoai.Id = 4;
            this.bbitoamuangoai.ItemAppearance.Normal.ForeColor = Color.Blue;
            this.bbitoamuangoai.ItemAppearance.Normal.Options.UseForeColor = true;
            this.bbitoamuangoai.ItemShortcut = new BarShortcut(Keys.F9);
            this.bbitoamuangoai.Name = "bbitoamuangoai";
            this.bbitoamuangoai.ItemClick += new ItemClickEventHandler(this.bbitoamuangoai_ItemClick);
            this.barDockControlTop.CausesValidation = false;
            this.barDockControlTop.Dock = DockStyle.Top;
            this.barDockControlTop.Location = new Point(0, 0);
            this.barDockControlTop.Size = new Size(0x400, 0x23);
            this.barDockControlBottom.CausesValidation = false;
            this.barDockControlBottom.Dock = DockStyle.Bottom;
            this.barDockControlBottom.Location = new Point(0, 500);
            this.barDockControlBottom.Size = new Size(0x400, 0);
            this.barDockControlLeft.CausesValidation = false;
            this.barDockControlLeft.Dock = DockStyle.Left;
            this.barDockControlLeft.Location = new Point(0, 0x23);
            this.barDockControlLeft.Size = new Size(0, 0x1d1);
            this.barDockControlRight.CausesValidation = false;
            this.barDockControlRight.Dock = DockStyle.Right;
            this.barDockControlRight.Location = new Point(0x400, 0x23);
            this.barDockControlRight.Size = new Size(0, 0x1d1);
            this.barStaticItem1.Caption = "barStaItem1";
            this.barStaticItem1.Id = 0;
            this.barStaticItem1.Name = "barStaticItem1";
            this.barStaticItem1.TextAlignment = StringAlignment.Near;
            this.groupControl4.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupControl4.Controls.Add(this.gridds);
            this.groupControl4.Location = new Point(1, 30);
            this.groupControl4.Name = "groupControl4";
            this.groupControl4.Size = new Size(0xe5, 0x1b7);
            this.groupControl4.TabIndex = 12;
            this.groupControl4.Text = "Danh s\x00e1ch chờ";
            this.gridds.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.gridds.Location = new Point(2, 0x15);
            this.gridds.MainView = this.gridView1;
            this.gridds.Name = "gridds";
            this.gridds.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit2, this.repositoryItemTextEdit3 });
            this.gridds.Size = new Size(0xe0, 0x1a0);
            this.gridds.TabIndex = 0x13;
            this.gridds.ViewCollection.AddRange(new BaseView[] { this.gridView1 });
            this.gridds.DoubleClick += new EventHandler(this.gridds_DoubleClick);
            this.gridView1.Appearance.ColumnFilterButton.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.ColumnFilterButton.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.ColumnFilterButton.ForeColor = Color.Black;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseBackColor = true;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseForeColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.ColumnFilterButtonActive.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.ColumnFilterButtonActive.ForeColor = Color.Black;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseBackColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseBorderColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseForeColor = true;
            this.gridView1.Appearance.Empty.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.Empty.BackColor2 = Color.White;
            this.gridView1.Appearance.Empty.Options.UseBackColor = true;
            this.gridView1.Appearance.EvenRow.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.EvenRow.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.EvenRow.ForeColor = Color.Black;
            this.gridView1.Appearance.EvenRow.Options.UseBackColor = true;
            this.gridView1.Appearance.EvenRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.EvenRow.Options.UseForeColor = true;
            this.gridView1.Appearance.FilterCloseButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.FilterCloseButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.FilterCloseButton.ForeColor = Color.Black;
            this.gridView1.Appearance.FilterCloseButton.Options.UseBackColor = true;
            this.gridView1.Appearance.FilterCloseButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.FilterCloseButton.Options.UseForeColor = true;
            this.gridView1.Appearance.FilterPanel.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.FilterPanel.BackColor2 = Color.White;
            this.gridView1.Appearance.FilterPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.FilterPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.FilterPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.FixedLine.BackColor = Color.FromArgb(0x7a, 0x72, 0x71);
            this.gridView1.Appearance.FixedLine.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedCell.BackColor = Color.White;
            this.gridView1.Appearance.FocusedCell.ForeColor = Color.Black;
            this.gridView1.Appearance.FocusedCell.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedCell.Options.UseForeColor = true;
            this.gridView1.Appearance.FocusedRow.BackColor = Color.FromArgb(200, 0xc0, 0x9d);
            this.gridView1.Appearance.FocusedRow.BorderColor = Color.FromArgb(0xe2, 0xdb, 0xbc);
            this.gridView1.Appearance.FocusedRow.ForeColor = Color.Black;
            this.gridView1.Appearance.FocusedRow.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.FocusedRow.Options.UseForeColor = true;
            this.gridView1.Appearance.FooterPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.FooterPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.FooterPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.FooterPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.FooterPanel.Options.UseBorderColor = true;
            this.gridView1.Appearance.FooterPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.GroupButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.GroupButton.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupFooter.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupFooter.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupFooter.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupFooter.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupFooter.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupFooter.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupPanel.BackColor = Color.FromArgb(0xf6, 0xf2, 0xd5);
            this.gridView1.Appearance.GroupPanel.BackColor2 = Color.White;
            this.gridView1.Appearance.GroupPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupRow.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupRow.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupRow.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupRow.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupRow.Options.UseForeColor = true;
            this.gridView1.Appearance.HeaderPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HeaderPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HeaderPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.HeaderPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.HeaderPanel.Options.UseBorderColor = true;
            this.gridView1.Appearance.HeaderPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.HideSelectionRow.BackColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.HideSelectionRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.HideSelectionRow.ForeColor = Color.Black;
            this.gridView1.Appearance.HideSelectionRow.Options.UseBackColor = true;
            this.gridView1.Appearance.HideSelectionRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.HideSelectionRow.Options.UseForeColor = true;
            this.gridView1.Appearance.HorzLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HorzLine.Options.UseBackColor = true;
            this.gridView1.Appearance.OddRow.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.OddRow.BorderColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.OddRow.ForeColor = Color.Black;
            this.gridView1.Appearance.OddRow.Options.UseBackColor = true;
            this.gridView1.Appearance.OddRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.OddRow.Options.UseForeColor = true;
            this.gridView1.Appearance.Preview.BackColor = Color.FromArgb(0xfb, 0xfc, 0xf7);
            this.gridView1.Appearance.Preview.Font = new Font("Verdana", 7.5f);
            this.gridView1.Appearance.Preview.ForeColor = Color.FromArgb(0x94, 0x94, 0x94);
            this.gridView1.Appearance.Preview.Options.UseBackColor = true;
            this.gridView1.Appearance.Preview.Options.UseFont = true;
            this.gridView1.Appearance.Preview.Options.UseForeColor = true;
            this.gridView1.Appearance.Row.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.Row.ForeColor = Color.Black;
            this.gridView1.Appearance.Row.Options.UseBackColor = true;
            this.gridView1.Appearance.Row.Options.UseForeColor = true;
            this.gridView1.Appearance.RowSeparator.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.RowSeparator.BackColor2 = Color.White;
            this.gridView1.Appearance.RowSeparator.Options.UseBackColor = true;
            this.gridView1.Appearance.SelectedRow.BackColor = Color.FromArgb(0xdd, 0xd7, 0xbc);
            this.gridView1.Appearance.SelectedRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.SelectedRow.ForeColor = Color.Black;
            this.gridView1.Appearance.SelectedRow.Options.UseBackColor = true;
            this.gridView1.Appearance.SelectedRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.SelectedRow.Options.UseForeColor = true;
            this.gridView1.Appearance.TopNewRow.BackColor = Color.White;
            this.gridView1.Appearance.TopNewRow.Options.UseBackColor = true;
            this.gridView1.Appearance.VertLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.VertLine.Options.UseBackColor = true;
            this.gridView1.Columns.AddRange(new GridColumn[] { this.gridds_ma, this.gridds_ten, this.gridds_id, this.gridds_namsinh });
            condition.Appearance.ForeColor = Color.Red;
            condition.Appearance.Options.UseForeColor = true;
            condition.Condition = FormatConditionEnum.Between;
            condition.Value1 = "0";
            condition.Value2 = "0";
            this.gridView1.FormatConditions.AddRange(new StyleFormatCondition[] { condition });
            this.gridView1.GridControl = this.gridds;
            this.gridView1.Name = "gridView1";
            this.gridView1.OptionsBehavior.AllowAddRows = DefaultBoolean.True;
            this.gridView1.OptionsBehavior.AllowDeleteRows = DefaultBoolean.False;
            this.gridView1.OptionsBehavior.ReadOnly = true;
            this.gridView1.OptionsView.AutoCalcPreviewLineCount = true;
            this.gridView1.OptionsView.ColumnAutoWidth = false;
            this.gridView1.OptionsView.EnableAppearanceEvenRow = true;
            this.gridView1.OptionsView.EnableAppearanceOddRow = true;
            this.gridView1.OptionsView.RowAutoHeight = true;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.gridds_ma.Caption = "M\x00e3 số";
            this.gridds_ma.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_ma.FieldName = "mabn";
            this.gridds_ma.Name = "gridds_ma";
            this.gridds_ma.OptionsColumn.AllowEdit = false;
            this.gridds_ma.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, "ma", "Tổng cộng={0:n0}") });
            this.gridds_ma.Visible = true;
            this.gridds_ma.VisibleIndex = 0;
            this.gridds_ma.Width = 0x5b;
            this.repositoryItemTextEdit2.AutoHeight = false;
            this.repositoryItemTextEdit2.Name = "repositoryItemTextEdit2";
            this.repositoryItemTextEdit2.ReadOnly = true;
            this.gridds_ten.Caption = "Họ v\x00e0 t\x00ean";
            this.gridds_ten.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_ten.FieldName = "hoten";
            this.gridds_ten.Name = "gridds_ten";
            this.gridds_ten.OptionsColumn.AllowEdit = false;
            this.gridds_ten.Visible = true;
            this.gridds_ten.VisibleIndex = 1;
            this.gridds_ten.Width = 0x12e;
            this.gridds_id.Caption = "id";
            this.gridds_id.FieldName = "idql";
            this.gridds_id.Name = "gridds_id";
            this.gridds_namsinh.Caption = "NS";
            this.gridds_namsinh.Name = "gridds_namsinh";
            this.gridds_namsinh.Visible = true;
            this.gridds_namsinh.VisibleIndex = 2;
            this.repositoryItemTextEdit3.AutoHeight = false;
            this.repositoryItemTextEdit3.DisplayFormat.FormatString = "n0";
            this.repositoryItemTextEdit3.DisplayFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit3.EditFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit3.Mask.EditMask = "n0";
            this.repositoryItemTextEdit3.Mask.MaskType = MaskType.Numeric;
            this.repositoryItemTextEdit3.Name = "repositoryItemTextEdit3";
            base.AutoScaleMode = AutoScaleMode.None;
            base.Controls.Add(this.groupControl4);
            base.Controls.Add(this.groupControl3);
            base.Controls.Add(this.groupControl2);
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.sbtnketthuc);
            base.Controls.Add(this.sbtnsua);
            base.Controls.Add(this.sbtnboqua);
            base.Controls.Add(this.sbtnluu);
            base.Controls.Add(this.sbtntieptheo);
            base.Controls.Add(this.barDockControlLeft);
            base.Controls.Add(this.barDockControlRight);
            base.Controls.Add(this.barDockControlBottom);
            base.Controls.Add(this.barDockControlTop);
            this.LookAndFeel.SkinName = "Blue";
            base.Name = "ucbn_khambenh";
            base.Size = new Size(0x400, 500);
            base.Load += new EventHandler(this.ucbn_tiepdon_Load);
            base.ControlRemoved += new ControlEventHandler(this.ucbn_khambenh_ControlRemoved);
            base.KeyDown += new KeyEventHandler(this.ucbn_tiepdon_KeyDown);
            this.txtmabn2.Properties.EndInit();
            this.txthoten.Properties.EndInit();
            this.txtdiachi.Properties.EndInit();
            this.txtdienthoai.Properties.EndInit();
            this.txtnamsinh.Properties.EndInit();
            this.txttuoi.Properties.EndInit();
            this.txtnguoithan.Properties.EndInit();
            this.txtnguoithanten.Properties.EndInit();
            this.txtnguoithanlienhe.Properties.EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.groupControl1.PerformLayout();
            this.lkploaituoi.Properties.EndInit();
            this.txtmaphuongxa.Properties.EndInit();
            this.txttenphuongxa.Properties.EndInit();
            this.groupControl2.EndInit();
            this.groupControl2.ResumeLayout(false);
            this.lkephong.Properties.EndInit();
            this.lkpdoituong.Properties.EndInit();
            this.txtcannang.Properties.EndInit();
            this.txthuyetap.Properties.EndInit();
            this.txtnhietdo.Properties.EndInit();
            this.txtghichu.Properties.EndInit();
            this.txtmabacsi.Properties.EndInit();
            this.txtmachandoankt.Properties.EndInit();
            this.txtmachandoan.Properties.EndInit();
            this.txtxutri.Properties.EndInit();
            this.txttenbacsi.Properties.EndInit();
            this.txttenchandoankt.Properties.EndInit();
            this.txttenchandoan.Properties.EndInit();
            this.txttrieuchung.Properties.EndInit();
            this.txtlydokham.Properties.EndInit();
            this.txtstt.Properties.EndInit();
            this.txtmach.Properties.EndInit();
            this.datengaygio.Properties.VistaTimeProperties.EndInit();
            this.datengaygio.Properties.EndInit();
            this.groupControl3.EndInit();
            this.groupControl3.ResumeLayout(false);
            this.tldk.EndInit();
            this.repositoryItemTextEdit1.EndInit();
            this.barManager1.EndInit();
            this.groupControl4.EndInit();
            this.groupControl4.ResumeLayout(false);
            this.gridds.EndInit();
            this.gridView1.EndInit();
            this.repositoryItemTextEdit2.EndInit();
            this.repositoryItemTextEdit3.EndInit();
            base.ResumeLayout(false);
        }

        private void lkploaituoi_EditValueChanged(object sender, EventArgs e)
        {
            this.txttuoi_Validated(sender, e);
        }

        private void sbtnboqua_Click(object sender, EventArgs e)
        {
            this.f_loadcontrol_chophepsua(false);
        }

        private void sbtnluu_Click(object sender, EventArgs e)
        {
            if (this.f_kiemtra_luu())
            {
                dtoBNBenhAnKB dtokhambenh = new dtoBNBenhAnKB(this._xuli.pConFigData) {
                    pBENHCHINH = this.txttenchandoan.Text,
                    pBENHKEMTHEO = this.txttenchandoankt.Text,
                    pGHICHU = this.txtghichu.Text,
                    pIDQL = long.Parse(this.txthoten.Tag.ToString()),
                    pMABN = this.txtmabn2.Text,
                    pIDBACSI = int.Parse(this.txtmabacsi.Tag.ToString()),
                    pIDBENHCHINH = int.Parse(this.txtmachandoan.Tag.ToString()),
                    pIDBENHKEMTHEO = int.Parse(this.txtmachandoankt.Tag.ToString()),
                    pNGAY = this.datengaygio.Text,
                    pTRIEUCHUNG = this.txttrieuchung.Text,
                    pXUTRI = this.txtxutri.Text,
                    pIDPHONG = int.Parse(this.lkephong.EditValue.ToString()),
                    pIDDOITUONG = int.Parse(this.lkpdoituong.EditValue.ToString()),
                    pIDDANGNHAP = this._iiddangnhap
                };
                long num = long.Parse(this.datengaygio.Tag.ToString());
                if (num == 0L)
                {
                    dtokhambenh.pIDQL = long.Parse(this._xuli.f_Get_CapID());
                    num = this._khambenh.f_insert(dtokhambenh);
                    if (num == 0L)
                    {
                        MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin kh\x00e1m bệnh.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                }
                else
                {
                    dtokhambenh.pIDQL = num;
                    if (this._khambenh.f_update(dtokhambenh) == 0L)
                    {
                        MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin kh\x00e1m bệnh.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        return;
                    }
                }
                this.datengaygio.Tag = num.ToString();
                this.f_loadcontrol_caclankb(dtokhambenh.pMABN);
                this.f_loadcontrol_chophepsua(false);
            }
        }

        private void sbtnsua_Click(object sender, EventArgs e)
        {
            if (!(this.datengaygio.Tag.ToString() == "0"))
            {
                this.f_loadcontrol_chophepsua(true);
            }
        }

        public virtual void stbnketthuc_Click(object sender, EventArgs e)
        {
            XtraTabPage parent = (XtraTabPage) base.Parent;
            XtraTabControl control = (XtraTabControl) parent.Parent;
            control.TabPages.Remove(parent);
        }

        private void stbntieptheo_Click(object sender, EventArgs e)
        {
            this.f_loaddata_dmbenhtat();
            this.f_loadcontrol_benhnhan("", "", 0, "", 0, "", "", 0L);
            this.f_loadcontrol_thongtinlienhe("", "", "", "");
            this.f_loadcontrol_thongtintd(0L, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 1, 1M, "", "", "", "", 1, "");
            this.f_loadcontrol_thongtinkb(0L, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 0, 0M, "", "", 0, "", 0, 0, "", "");
            this.tldk.Nodes.Clear();
            this._dtotd = new dtoBNTiepDon(this._xuli.pConFigData);
            base.ActiveControl = this.txtmabn2;
            this.f_loadcontrol_chophepsua(true);
            this.f_load_dsbnchokham();
            this.f_loaddata_dmbacsi();
        }

        private void tldk_Click(object sender, EventArgs e)
        {
            try
            {
                long idql = 0L;
                try
                {
                    idql = Convert.ToInt64(this.txthoten.Tag.ToString());
                }
                catch
                {
                }
                if ((idql <= 0L) || (this.txttenchandoan.Text == ""))
                {
                    DataTable table = this._dtkhambenh.Copy();
                    try
                    {
                        idql = Convert.ToInt64(table.Rows[0]["idql"].ToString());
                    }
                    catch
                    {
                    }
                    this.f_setcontrol_bnkhambenh(idql, "");
                }
            }
            catch
            {
            }
        }

        private void tldk_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            try
            {
                this.f_setcontrol_bnkhambenh(long.Parse(e.Node.GetValue(this.tldk_idql).ToString()), "");
            }
            catch
            {
            }
        }

        private void txtghichu_Validated(object sender, EventArgs e)
        {
            if (!(this.txtghichu.Text == ""))
            {
                this.txtghichu.Text = this.txtghichu.Text.Substring(0, 1).ToUpper() + this.txtghichu.Text.Substring(1);
            }
        }

        private void txtmabacsi_Validated(object sender, EventArgs e)
        {
            if (this.txtmabacsi.Text.Trim() != "")
            {
                try
                {
                    this.f_load_bacsi(this.txtmabacsi.Text);
                    this.txtxutri.Focus();
                }
                catch
                {
                    this.f_load_control_dmbs(0, "", "");
                }
            }
        }

        private void txtmabn2_Validated(object sender, EventArgs e)
        {
            if (this.txtmabn2.Text != "")
            {
                string mabn = this.txtmabn2.Text.Substring(0, 4) + this.txtmabn2.Text.Substring(4).PadLeft(6, '0');
                this.txtmabn2.Text = mabn;
                this.f_setcontrol_bnkhambenh(0L, mabn);
                this.f_loadcontrol_caclankb(mabn);
                if (this.sbtnluu.Enabled)
                {
                    this.f_loadcontrol_thongtinkb(0L, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), 1, 1M, "", "", 0, "", 0, 0, "", "");
                }
            }
        }

        private void txtmachandoan_Validated(object sender, EventArgs e)
        {
            if (this.txtmachandoan.Text.Trim() != "")
            {
                try
                {
                    this.f_load_benhtat(this.txtmachandoan.Text);
                    this.txtmachandoankt.Focus();
                    this.ctrdanhsach_cd.Visible = false;
                }
                catch
                {
                    this.f_load_control_dmbenhtat(0L, "", "");
                }
            }
        }

        private void txtmachandoankt_Validated(object sender, EventArgs e)
        {
            if (this.txtmachandoankt.Text.Trim() != "")
            {
                try
                {
                    this.f_load_benhkemtheo(this.txtmachandoankt.Text);
                    this.txtmabacsi.Focus();
                    this.ctrdanhsach_cdkt.Visible = false;
                }
                catch
                {
                    this.f_load_control_dmbenhkemtheo(0L, "", "");
                }
            }
        }

        private void txtmaphuongxa_Validated(object sender, EventArgs e)
        {
            this.f_setcontrol_phuongxa(0L, this.txtmaphuongxa.Text);
        }

        private void txtnamsinh_Validated(object sender, EventArgs e)
        {
            try
            {
                DateTime time = new BNTiepDon().f_tinh_ngaytuoi(this.txtngaysinh.Text, int.Parse(this.txtnamsinh.Text), 0, 0);
                this.txttuoi.Text =string.Concat(DateTime.Now.Year - time.Year);
            }
            catch
            {
            }
        }

        private void txtngaysinh_Validated(object sender, EventArgs e)
        {
            try
            {
                DateTime time = new BNTiepDon().f_tinh_ngaytuoi(this.txtngaysinh.Text, (this.txtnamsinh.Text == "") ? 0 : int.Parse(this.txtnamsinh.Text), 0, 0);
                this.txttuoi.Text =string.Concat(DateTime.Now.Year - time.Year);
                this.txtnamsinh.Text = time.Year.ToString();
            }
            catch
            {
            }
        }

        private void txttenbacsi_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_bsdt.Width = (this.txttenbacsi.Width + this.txttenbacsi.Location.X) - this.txtmabacsi.Location.X;
            this.ctrdanhsach_bsdt.DanhSachCotHienThi_kt = "50," + ((this.ctrdanhsach_bsdt.Width - 0x34));
            this.ctrdanhsach_bsdt.Location = new Point(this.txtmabacsi.Location.X, (this.txtmabacsi.Location.Y + this.txtmabacsi.Height) + 1);
            this.ctrdanhsach_bsdt.BringToFront();
        }

        private void txttenbacsi_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                this.ctrdanhsach_bsdt.Visible = true;
                this.ctrdanhsach_bsdt.Focus();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_bsdt.Visible = false;
            }
            else
            {
                this.ucbn_tiepdon_KeyDown(sender, e);
            }
        }

        private void txttenbacsi_TextChanged(object sender, EventArgs e)
        {
            if (this.txttenbacsi.IsEditorActive)
            {
                this.ctrdanhsach_bsdt.Visible = true;
                this.ctrdanhsach_bsdt.Locdulieu(this.txttenbacsi.Text);
            }
        }

        private void txttenchandoan_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_cd.Width = (this.txttenchandoan.Width + this.txttenchandoan.Location.X) - this.txtmachandoan.Location.X;
            this.ctrdanhsach_cd.DanhSachCotHienThi_kt = "50," + ((this.ctrdanhsach_cd.Width - 0x34));
            this.ctrdanhsach_cd.Location = new Point(this.txtmachandoan.Location.X, (this.txtmachandoan.Location.Y + this.txtmachandoan.Height) + 1);
            this.ctrdanhsach_cd.BringToFront();
        }

        private void txttenchandoan_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                this.ctrdanhsach_cd.Visible = true;
                this.ctrdanhsach_cd.Focus();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_cd.Visible = false;
            }
            else
            {
                this.ucbn_tiepdon_KeyDown(sender, e);
            }
        }

        private void txttenchandoan_TextChanged(object sender, EventArgs e)
        {
            if (this.txttenchandoan.IsEditorActive)
            {
                this.ctrdanhsach_cd.Visible = true;
                this.ctrdanhsach_cd.Locdulieu(this.txttenchandoan.Text);
            }
        }

        private void txttenchandoankt_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_cdkt.Width = (this.txttenchandoankt.Width + this.txttenchandoankt.Location.X) - this.txtmachandoankt.Location.X;
            this.ctrdanhsach_cdkt.DanhSachCotHienThi_kt = "50," + ((this.ctrdanhsach_cdkt.Width - 0x34));
            this.ctrdanhsach_cdkt.Location = new Point(this.txtmachandoankt.Location.X, (this.txtmachandoankt.Location.Y + this.txtmachandoankt.Height) + 1);
            this.ctrdanhsach_cdkt.BringToFront();
        }

        private void txttenchandoankt_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                this.ctrdanhsach_cdkt.Visible = true;
                this.ctrdanhsach_cdkt.Focus();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_cdkt.Visible = false;
            }
            else if (e.KeyCode == Keys.Enter)
            {
                this.ctrdanhsach_cdkt.Visible = false;
                this.ucbn_tiepdon_KeyDown(sender, e);
            }
            else
            {
                this.ucbn_tiepdon_KeyDown(sender, e);
            }
        }

        private void txttenchandoankt_TextChanged(object sender, EventArgs e)
        {
            if (this.txttenchandoankt.IsEditorActive)
            {
                this.ctrdanhsach_cdkt.Visible = true;
                this.ctrdanhsach_cdkt.Locdulieu(this.txttenchandoankt.Text);
            }
        }

        private void txttrieuchung_Validated(object sender, EventArgs e)
        {
            if (!(this.txttrieuchung.Text == ""))
            {
                this.txttrieuchung.Text = this.txttrieuchung.Text.Substring(0, 1).ToUpper() + this.txttrieuchung.Text.Substring(1);
            }
        }

        private void txttuoi_Validated(object sender, EventArgs e)
        {
            try
            {
                DateTime time = new BNTiepDon().f_tinh_ngaytuoi("", 0, Convert.ToInt16(this.txttuoi.Text), int.Parse(this.lkploaituoi.EditValue.ToString()));
                if (int.Parse(this.lkploaituoi.EditValue.ToString()) != HangSo.LoaiTuoi.pTuoi)
                {
                    this.txtngaysinh.Text = time.ToString("dd/MM/yyyy");
                }
                this.txtnamsinh.Text = time.ToString("yyyy");
            }
            catch
            {
            }
        }

        private void txtxutri_EditValueChanged(object sender, EventArgs e)
        {
            if (this.txtxutri.IsEditorActive)
            {
                this.f_load_xutri(this.txtxutri.Text);
            }
        }

        private void ucbn_khambenh_ControlRemoved(object sender, ControlEventArgs e)
        {
            if (e.Control.Name == "ucbn_dsbncho")
            {
                this._dtotd.pIDQL = this.ucdsbncho.pIDQLSelected;
                this._dtotd.Load();
                this.ucdsbncho = null;
                try
                {
                    this.f_setcontrol_bnkhambenh(this._dtotd.pIDQL, "");
                    this.txttrieuchung.Focus();
                }
                catch
                {
                }
            }
            else if (((e.Control.Name == "ucbn_captoathuoc") || (e.Control.Name == "ucbn_chidinh")) || (e.Control.Name == "ucbn_captoathuocmuangoai"))
            {
                this.datengaygio.Focus();
            }
            else if (e.Control.Name == "ucbn_dmbenhtat")
            {
                this.f_loaddata_dmbenhtat();
                this.txttenchandoan.Focus();
            }
            else if (e.Control.Name == "ucbn_thongtinbn")
            {
                try
                {
                    this.txtmabn2.Text = this._ucbn.pMaBNChon;
                    this._ucbn = null;
                    this.txtmabn2_Validated(null, null);
                    this.txttenchandoan.Focus();
                }
                catch
                {
                }
            }
        }

        private void ucbn_tiepdon_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (this.sbtntieptheo.Enabled)
                {
                    this.stbntieptheo_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F3)
            {
                if (this.sbtnsua.Enabled)
                {
                    this.sbtnsua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F4)
            {
                if (this.sbtnboqua.Enabled)
                {
                    this.sbtnboqua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F5)
            {
                if (this.sbtnluu.Enabled)
                {
                    this.sbtnluu_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F10)
            {
                this.bbidsbncho_ItemClick(null, null);
            }
            else if (e.KeyCode == Keys.F7)
            {
                this.bbichidinh_ItemClick(null, null);
            }
            else if (e.KeyCode == Keys.F8)
            {
                this.bbicaptoa_ItemClick(null, null);
            }
            else if (e.KeyCode == Keys.F9)
            {
                this.bbitoamuangoai_ItemClick(null, null);
            }
            else if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{Tab}");
            }
            else if ((e.KeyCode == Keys.F12) && this.sbtnketthuc.Enabled)
            {
                this.stbnketthuc_Click(null, null);
            }
        }

        private void ucbn_tiepdon_Load(object sender, EventArgs e)
        {
            this._tsbenhnhan = new BNThongSo(this._xuli.pConFigData);
            this._khambenh = new BNKhamBenh(this._xuli.pConFigData);
            this._tiepdon = new BNTiepDon(this._xuli.pConFigData);
            this.datengaygio.EditValue = DateTime.Now;
            this.lkpdoituong.Properties.DataSource = new BNDanhMuc(this._xuli.pConFigData).f_load_bn_dmdoituong();
            this.lkpdoituong.Properties.DisplayMember = "ten";
            this.lkpdoituong.Properties.ValueMember = "id";
            this.lkpdoituong.ItemIndex = 0;
            DataTable table = HangSo.LoaiTuoi.f_DanhSach();
            this.lkploaituoi.Properties.DataSource = table;
            this.lkploaituoi.Properties.DisplayMember = "ten";
            this.lkploaituoi.Properties.ValueMember = "id";
            this.lkploaituoi.ItemIndex = 0;
            table = new BNDanhMuc(this._xuli.pConFigData).f_loaddata_bn_dmphong(true);
            this.lkephong.Properties.DataSource = table;
            this.lkephong.Properties.DisplayMember = "ten";
            this.lkephong.Properties.ValueMember = "id";
            this.lkephong.ItemIndex = 0;
            this.f_loaddata_dmbenhtat();
            this.f_loaddata_dmbacsi();
            this.stbntieptheo_Click(null, null);
            base.ActiveControl = this.txtmabn2;
        }
    }
}

